Or perhaps you don't need to remove all the items and are just hacking round a more targeted removal strategy? How do I access the underlying memory cache to dispose it and instantiate a new one?To get the most benefits from the cache, it is best not to throw away all the data stored in it if you can. Seems there is no properties "keys" or "memorycache" that I can use for a "foreach" loop. Cheers You would need to either create an instance of Memory Cache yourself and pass it into the Lazy Cache constructor to have access to the instance, or use Memory Cache.If you are into serverless, today is your lucky day!I can remove an cache item, but how do I clear the whole cache.A cache in front of Dynamo DB is boosting performance and saving costs. But setting up cache invalidation is not that hard when using the following building blocks: Elasti Cache, Dynamo DB, Dynamo DB Streams and Lambda as shown in the following figure.Especially true for read-intensive and spiky workloads. Please have a look at one of my recent articles: Performance boost and cost savings for Dynamo DB. You'll learn how to implement a Lambda function doing cache invalidation in this article.When the data changes—and only then—the cache items based on that data are invalidated and removed from the cache.
If you are using SQL Server 2005 you can also set a dependency on a specific record.There are no properties or methods I can use on this instance. How do I do that by using the new Object Cache property or is there any other way?See also Why didn't you expose the Memory Cache instance? Update: Seems I forgot to add a reference to System. Object Cache has no "select" method to iterate over all elements. In which case you would need to iterate over each of the keys in the memory cache and remove the cache item.Neither Lazy Cache nor Memory Cache provide a built in in way to remove all items, because usually this need indicates another issue - for example should you instead be disposing instances of the underlying cache and recreating them?You would then need to dispose that (or iterate over the keys and remove them however this is not recommended by microsoft as it is expensive) and recreate your caching service instance with a new object cache constructor parameter.Lazy Cache 0.7 now exposes the underlying Object Cache - see https://github.com/alastairtree/Lazy Cache/blob/master/Lazy Cache/IApp Update 3: Found an interesting concept to clear only a subset of keys.This would allow you to iterate over the keys and remove entries if you really need to clear the cache that way, however I would still recommend managing your own instance of Memory Cache and recreating that to clear the cache. Hello, got your new version and tried to dispose the cache by using the new Object Cache property. Maybe this is useful for a new version of Lazy Cache.From my understanding this is not possible, because the class "Object Cache" is abstract and cannot be used in any way. ( So now I just want to remove all items of instance cache1.Without caching, your application must request the data from the database each time a user wants to view a product.You could cache the product information for a day at a time, ensuring fast response times because the product information is already in memory.