python-diskcache icon indicating copy to clipboard operation
python-diskcache copied to clipboard

cache.incr does not support tagging

Open BoPeng opened this issue 9 months ago • 0 comments

I am using tags to manage and evict keys based on their tags. However, I noticed that cache.incr does not accept a tag parameter, resulting in all keys created by cache.incr having a None tag.

Current workaround:

try:
    cache.incr(key, delta, default=None)
except KeyError:
    cache.set(key, delta, tag='counter')

Proposed enhancement: It would be more straightforward and efficient if cache.incr could accept a tag parameter, allowing:

cache.incr(key, delta, tag='counter')

This enhancement would simplify the code and ensure consistency in tagging keys.

BoPeng avatar Feb 11 '25 02:02 BoPeng