
Maybe i have many cache keys that name's contains permission-Ĭan i remove cache key that names contains permission. More detail information, see Cache in-memory in ASP.NET Core The above code removes a cache item and calls Compact to remove 25% of cached entries. Pinned items with priority NeverRemove are never removed.

To clear the cache entry, you could use the Compact or Remove method, like this: _myMemor圜(CacheKeys.Entry) _memor圜ache.Set(CacheKeys.Entry, cacheValue, cacheEntryOptions) SetSlidingExpiration(TimeSpan.FromSeconds(3))

Var cacheEntryOptions = new Memor圜acheEntryOptions() Like this: if (!_memor圜ache.TryGetValue(CacheKeys.Entry, out DateTime cacheValue))

To reset the cache entry, first you could get the exist cache entry (use the TryGetValue method), then use the Set Method to reset the value.
