#22495: Locmem cache.add() fails with infinitely cached objects
-------------------------------------+--------------------
     Reporter:  boxm                 |      Owner:  nobody
         Type:  Bug                  |     Status:  new
    Component:  Core (Cache system)  |    Version:  1.6
     Severity:  Normal               |   Keywords:
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+--------------------
 Simple test case:

 {{{
 from django.core.cache.backends.locmem import LocMemCache

 c2 = LocMemCache("locmem", {})

 In [18]: c2.set('test', 'locked', timeout=None)

 In [19]: c2.add('test', 'new')
 Out[19]: True

 In [20]: c2.get('test')
 Out[20]: 'new'
 }}}

 Since a timeout of None now means "cache forever", the cache.add() should
 not succeed and should return False.

 Memcached behaviour for comparison:

 {{{
 In [24]: from django.core.cache.backends.memcached import PyLibMCCache

 In [25]: memcache = PyLibMCCache(server="localhost:11211", params={})

 In [26]: memcache.set('test', 'locked', timeout=None)

 In [27]: memcache.add('test', 'new')
 Out[27]: False
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22495>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/047.7175f88301909e7878285511e63e9742%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to