incr() on locmem cache resets the expiry time
|Reported by:||boxm||Owned by:||berkerpeksag|
|Component:||Core (Cache system)||Version:||1.5-rc-1|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by Alex)
On the locmem cache backend, calling incr() causes the key's timeout value to be reset to the default for the cache.
- setup the default cache to be locmem and with a timeout of 1 second
>> cache.set('key', 10, 300) >> time.sleep(1) >> cache.get('key') 10 >> cache.incr('key') >> time.sleep(1) >> cache.get('key') None
The cache should still contain the key at the last line.
The problem comes from the implementation of incr() in base.py which uses get() and set() to implement incr(). Since set() is called without a timeout, the cache default time is used.
Change History (11)
comment:1 Changed 4 years ago by Alex
- Description modified (diff)
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
Changed 4 years ago by boxm
Changed 4 years ago by manfre
comment:8 Changed 3 years ago by berkerpeksag
- Owner changed from paper82 to berkerpeksag
- Status changed from new to assigned
- Version changed from 1.3 to 1.5-rc-1