-
Notifications
You must be signed in to change notification settings - Fork 22
Closed as not planned
Description
I would like to report some issues with the FastCache<TKey, TValue> class, after inspecting briefly the source code.
- The internal
TtlValueis a class. It could be a struct (more lightweight, less pressure on the garbage collector). - It's possible for the
_EvictExpiredcallback to be invoked in an overlapping manner, if the cache contains many keys and thecleanupJobIntervalis very small. - The
FastCache<TKey, TValue>is not disposable, so there is no way to stop the timer. The timer will keep ticking until the class is garbage collected. - The
FastCache.GetOrAdddoes not use theConcurrentDictionary.GetOrAddoverload that has aTArggeneric argument, and so it results in an allocation of a closure on each invocation. - The full functionality of the underlying
ConcurrentDictionary<TKey, TValue>is not available. For example theFastCache<TKey, TValue>exposes avoid Remove(TKey key)method, and not abool TryRemove (TKey key, out TValue value)method.
Metadata
Metadata
Assignees
Labels
No labels