Base solution for your next web application
Open Closed

ICacheManager: invalidate single item #10056


User avatar
0
alexanderpilhar created

10.1.0, Angular

Is it possible to invalidate a single item in ICacheManager? I know I can update a single item or invalidate the whole Cache - but I'm dealing with a quite complex item and can't guarantee the item will contain all information necessary for each and every case, and also I don't want to invalidate the whole Cache.

I tried setting the cached item to null but that is not allowed.

Is it possible to extend ICacheManager adding a method that invalidates a single item?


2 Answer(s)
  • User Avatar
    1
    ismcagdas created
    Support Team

    Hi,

    Yes, you can do it as shown below;

    _cacheManager.GetCache("CacheName").Remove("ItemKey");

  • User Avatar
    0
    alexanderpilhar created

    Oh, wow, I totally overlooked that ...

    Thank you so much @ismcagdas!