aiocache
aiocache copied to clipboard
Cache expiration callback/event
Is it possible to implement cache expiration events on this lib? If it is can I have an example?
Do you mean a callback when a cached item expires?
If so, I think that would depend entirely on the backend. e.g. The SimpleMemoryBackend just schedules a function call later (https://github.com/aio-libs/aiocache/blob/master/aiocache/backends/memory.py#L37). So, by subclassing it, you could figure out a way to get a notification. But, if you use a memcached backend, then the expiration happens in memcached, so you'd need to figure out a way to get the information from there.