Opened 8 years ago

Closed 8 years ago

#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 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

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

comment:2 by Olexander Yermakov, 8 years ago

Owner: changed from nobody to Olexander Yermakov
Status: newassigned

comment:3 by Ed Morley, 8 years ago

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 by Olexander Yermakov, 8 years ago

Ok. Not a problem.

comment:5 by Ed Morley, 8 years ago

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

comment:6 by Tim Graham, 8 years ago

Triage Stage: AcceptedReady for checkin

Pending a few cosmetic edits.

comment:7 by Tim Graham <timograham@…>, 8 years ago

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