IMemoryCache class abstract

Represents a local in-memory cache whose values are not serialized.

Implementers
Available extensions

Constructors

IMemoryCache()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Removes all keys and values from the cache.
compact(double percentage) → void
Performs compaction on the cache by removing percentage of entries.
containsKey(Object key) bool
Gets a value indicating whether the cache entry associated with key exists.
createEntry(Object key) ICacheEntry
Creates or overwrites an entry in the cache.
get<T>(Object key) → T?

Available on IMemoryCache, provided by the MemoryCacheExtensions extension

Gets the value associated with key.
getCurrentStatistics() MemoryCacheStatistics?
Gets a snapshot of the cache statistics.
getOrCreate<T>(Object key, T factory(ICacheEntry entry)) → T

Available on IMemoryCache, provided by the MemoryCacheExtensions extension

Gets the value associated with key, or creates and caches a new value using factory if not found.
getOrCreateAsync<T>(Object key, Future<T> factory(ICacheEntry entry)) Future<T>

Available on IMemoryCache, provided by the MemoryCacheExtensions extension

Async version of getOrCreate.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(Object key) → void
Removes the value associated with key from the cache.
set<T>(Object key, T value, [MemoryCacheEntryOptions? options]) → T

Available on IMemoryCache, provided by the MemoryCacheExtensions extension

Sets the value for key.
toString() String
A string representation of this object.
inherited
tryGetValue<T>(Object key, void setValue(T? value)) bool
Gets the value associated with key if it exists.

Operators

operator ==(Object other) bool
The equality operator.
inherited