Replies: 3 comments 3 replies
-
Hi @lutzj7
No need for a specialized You can specify a lower Regarding instead the limit on the number of cache entries in L1, what you can do is create yourself a normal var memoryCache = new MemoryCache(new MemoryCacheOptions
{
SizeLimit = 10
}) and then pass that to FusionCache, like this: var fusionCache = new FusionCache(new FusionCacheOptions(), memoryCache); If you do this you then also need to specify, for each cache entry, the size of that entry via the Hope this helps, let me know. |
Beta Was this translation helpful? Give feedback.
-
Sorry for the late reply and of course many thanks for your answer. It's a little bit of topic but maybe you can also help me with this question: How can I determine the size of an object, so that I can use Size and SizeLimit with the real size of the object? My first thougt was to serialize the object, measure it (Length of the json string) do the size limiting stuff as needed and afterwards hand over it to the fusion cache. But the cache will than serialize it again... Can we disable that double serialization? |
Beta Was this translation helpful? Give feedback.
-
And a 2nd thing I just discovered. When one item initialy was not saved in L1 cache because of exceeding the SizeLimit it will not be saved back to L1 cache even if now is enough space again (other items are evicted..) Is there a way to solve that behavior? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Everybody
I'm searching for a way to limit the cache item size on L1 cache only. We have several instances/pods of our service and do not want to cache large item in memory because of the posible cost. Nevertheless the item should be stored on L2 cache anyway. The idea is to have a MaxL1CacheItemLimit as an configuration option.
One way is to have a specialized IMemoryCache implementation, but it feels better to have a native support from insight fusion cache...
Thx
Beta Was this translation helpful? Give feedback.
All reactions