#27152 closed Cleanup/optimization (fixed)

Comma-delimited servers list not supported in memcached caches `LOCATION`

Reported by: Ed Morley Owned by: Ed Morley
Component: Core (Cache system) Version: 1.10
Severity: Normal Keywords:
Cc: emorley@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently Django's memcached backends only support a semicolon delimited servers list in the cache config, such as:

CACHES = {
    'default': {
        'LOCATION': 'server1.foo.com;server2.foo.com',
    },
}

This is because the backend just does:

    self._servers = server.split(';')

However cloud memcached offerings such as Memcachier and Memcached Cloud typically use a comma-delimited list in the automatically set environment variable, eg:

MEMCACHIER_SERVERS='foo.us-east-5.heroku.prod.memcachier.com:11211,bar.us-east-5.heroku.prod.memcachier.com:11211'

Given that the caches LOCATION parameter contains only domain name and port (and not say passwords), it should never contain a comma - so we should be fine to also split on them too.

Change History (7)

comment:1 Changed 23 months ago by Tim Graham

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

I guess server.replace(',', ';').split(';') should work.

comment:2 Changed 23 months ago by Olexander Yermakov

Owner: changed from nobody to Olexander Yermakov
Status: newassigned

comment:3 Changed 23 months ago by Ed Morley

Owner: changed from Olexander Yermakov to Ed Morley

Ah I have this finished locally already - sorry thought I'd set the ticket assignee already!

comment:4 Changed 23 months ago by Olexander Yermakov

Ok. Not a problem.

comment:5 Changed 23 months ago by Ed Morley

Cc: emorley@… added
Has patch: set
Last edited 23 months ago by Tim Graham (previous) (diff)

comment:6 Changed 23 months ago by Tim Graham

Triage Stage: AcceptedReady for checkin

Pending a few cosmetic edits.

comment:7 Changed 23 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In d8ef5b0e:

Fixed #27152 -- Supported comma delimiter in memcached LOCATION string.

Note: See TracTickets for help on using tickets.
Back to Top