-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Eviction of an object happens immediately upon expiration #35
Comments
It would be optimal indeed, do you have a specific strategy in mind. The current implementation does delay eviction until a later stage, but it has the advantage of being relatively standard and easy to maintain. |
I have a couple of ideas, but I'm not sold on any of them yet.
Ideally I'd prefer option 2B, but I'm not entirely sure of how practical it is to achieve. |
Another option is to change the eviction from evicting object A when querying object A to evicting all objects that need eviction when querying any object. Basically change it to a more global approach on eviction rather than an object-by-object basis. I'm not a huge fan of this for my particular use cases since the query load on the cache is relatively low. This approach works better for a higher load cache. |
@pcman312 @aaronwinter |
Currently, the cache doesn't evict an object when the expiration of that object passes but rather waits until the next
Get()
call before evicting it. This is problematic when the object in the cache has connections/goroutines/etc. that should be closed when not in use. I propose restructuring the expiration code such that it evicts the object upon expiration rather than waiting for a subsequentGet()
call.The text was updated successfully, but these errors were encountered: