Opened 13 years ago

Last modified 12 years ago

#16858 closed Bug

incr() on locmem cache resets the expiry time — at Initial Version

Reported by: Malcolm Box Owned by: nobody
Component: Core (Cache system) Version: 1.5-rc-1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

On the locmem cache backend, calling incr() causes the key's timeout value to be reset to the default for the cache.

To reproduce:

  • 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 (0)

Note: See TracTickets for help on using tickets.
Back to Top