2

A similar question was posted here regarding adjusting the 1mb limit of memcached storage in Django settings. However, the answer was referring to django.core.cache.backends.memcached.MemcacheCache, which has since been deprecated.

I tried implementing to provided solution with the django.core.cache.backends.memcached.PyMemcacheCache backend but the provided OPTIONS ('server_max_value_length') is unrecognizable.

I can't find the available list of Options for the newer PyMemcache backend from django (at least not any that allow me to adjust the storage limit.

My Settings looks like this:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
        'LOCATION': 'cache:11211',
        'OPTIONS': {
            'server_max_value_length': 1024*1024*10
        }
    }
}

I am deploying the app in a Python 3 Docker image with a docker-config.yml configuration. The config file relative to memcached looks like:

 cache:
    image: memcached
    ports:
      - "11211:11211"
    entrypoint:
      - memcached
      - -m 64
      - -I 10m

When caching views that return JSON Responses with < 1MB data, the caching works great and greatly improves speed.

The main objective here is to speed up response times. As far as optimizing the query, its just a simple GET that filters off the authenticated users company. I think pagination would help speed up response time as well, seeing as this is a large list of data being returned. Just wanted to find the memcached limit options for the new PyMemcacheCache backend.

0 Answers0