Foundatio
Foundatio copied to clipboard
InMemoryCacheClient Maximum Size
In addition to being able to limit the total number of items, it would be nice to be able to limit the size, so that items could be removed due to memory pressure.
I'm not sure how you would efficiently get the objects size without a big hit to performance. Have you played around with this any? Typically we know the objects going into cache and can reason about size / maximum items we want to persist.
Well, you serialize everything you are putting into the cache aren't you? Wouldn't that let you know the size?
@Terebi42 for the in memory cache, it's an option on whether or not you want to serialize things when adding them to the cache.
Well, then maybe the maximum size feature would only work when serialization is on?
Yeah, that's a possibility. Would you want to submit a PR for this feature?