bluele / gcache

An in-memory cache library for golang. It supports multiple eviction policies: LRU, LFU, ARC
MIT License
2.6k stars 271 forks source link

expire check interval #77

Open Icemap opened 3 years ago

Icemap commented 3 years ago

I add an expire check interval in gcache. It can deal the situation when we need delete expire key timely. Such as using AddedFunc and EvictedFunc to monitoring key's lifecycle. PTAL.

木村くん、ご覧ください。お願いいたします。 @bluele

Icemap commented 3 years ago

PTAL @bluele

DoubleDi commented 2 years ago

Hi @bluele! Sorry for the ping! Great cache!

Made a try to switch from https://github.com/patrickmn/go-cache as yours has clearly a superior feature - cache size limit. But, unfortunately, using your LRU based cache I have received multiple memory leaks in my applications. I am thinking it is because the expired elements are not getting evicted by themselves.

Would be awesome to merge this, as it would be very useful in combined with the expiration feature