Is there any way to prevent infinite growth except from timeouts? #107
-
Hey! Great library and impressive docs! But I did not find an answer to the question in the title: Is there any way to prevent infinite growth in the MemoryCache except from using timeouts? The use-case is for a API for a read-only SQLite-database cache layer where the query responses are idempotent (the response for a query never changes). The SQLite database files are replaced daily, so a cache time of ~24 hours is preferred, but if memory is spent the oldest request should be removed from memory. There are potentially "infinite" queries that can be performed, and I want to trigger a cleanup in the style of either LRU (Least Recently Used) cache or FIFO, to clean X items (or size) cache to avoid infinite memory usage. Does this library have any way to handle the cache size? The dotnet |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Thanks! I'm glad you are liking it 🙂
Interesting use-case, I never seen something like this! Would you be willing to explain more?
This library (currently) works on top of the common abstractions in .NET (
Exactly, I was about to suggest that! The limitation you are talking about though can be bypassed thanks to Adaptive Caching. Basically during the execution of the factory, when you just got back your data from your data source but before returning it, you can change some of the options like, in this case, the Hope this helps, let me know! |
Beta Was this translation helpful? Give feedback.
Thanks! I'm glad you are liking it 🙂
Interesting use-case, I never seen something like this! Would you be willing to explain more?
Like, is SQLite used as a 2nd level, did I get this…