Closed Effervex closed 12 months ago
@Effervex Thanks for reporting, I will add a close
method to cache instance, and override the __del__
to make sure the extra thread is also stopped
@Effervex 0.4.1 released, call close
API explicitly if you want to stop the thread immediately. I also override the __del__
method, but seems cache instance won't be removed by gc immediately if you just del
it. To remove the cache entirety, please call cache.clear
and cache.stop
call
cache.clear
andcache.stop
Do you mean cache.clear
and cache.close
? cache.stop
doesn't exist.
@Effervex my mistake, if you want to delete a cache instance, first call cache.clear
and cache.close
, then del cache
Got it. I've tested it and it seems to work as expected. Thanks for the quick fix!
When a new Cache is initialised, a new Thread is spawned from the following code in the init method:
The Thread is never stopped and even if the Cache dies the thread remains and holds onto the cached data. Even if the data is cleared, the Thread will continue to persist.
Minimal Reproducible Example