How to save all items to memcached without losing them?
<pre><code>In [11]: from django.core.cache import cache

In [12]: keys = []

In [13]: for i in range(1, 10000):
    ...:     key = "Key%s" % i
    ...:     value = ("Value%s" % i)*5000
    ...:     cache.set(key, value, None)
    ...:     keys.append(key)
    ...:     # check lost keys
    ...:     lost = 0
    ...:     for k in keys:
    ...:         if not cache.get(k):
    ...:             lost += 1
    ...:     if lost:
    ...:         print "Lost %s in %s" % (lost, i)
</code></pre>

<p>I am using Django, memcached with python-memcached with below cache settings:  </p>

<pre><code>CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
    }
}
</code></pre>

<p>For the above program, I started losing caches from i=1437. Can you please tell me what to do so I can save all items to cache ?</p>

<p>You can achieve it by increasing Memcached cache size. </p>

python django memcached