MemoryCache class
Implementation of IMemoryCache.
- Implemented types
- Available extensions
Constructors
- MemoryCache(MemoryCacheOptions _options)
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.
override
-
compact(
double percentage) → void -
Performs compaction on the cache by removing
percentageof entries.override -
containsKey(
Object key) → bool -
Gets a value indicating whether the cache entry associated with
keyexists.override -
createEntry(
Object key) → ICacheEntry -
Creates or overwrites an entry in the cache.
override
-
dispose(
) → void - Disposes the cache and stops the expiration timer.
-
finalizeEntry(
CacheEntryInternal entry) → void - Finalizes an entry after configuration.
-
get<
T> (Object key) → T? -
Available on IMemoryCache, provided by the MemoryCacheExtensions extension
Gets the value associated withkey. -
getCurrentStatistics(
) → MemoryCacheStatistics? -
Gets a snapshot of the cache statistics.
override
-
getOrCreate<
T> (Object key, T factory(ICacheEntry entry)) → T -
Available on IMemoryCache, provided by the MemoryCacheExtensions extension
Gets the value associated withkey, or creates and caches a new value usingfactoryif 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
keyfrom the cache.override -
removeEntry(
Object key, EvictionReason reason) → void - Internal remove method with eviction reason.
-
set<
T> (Object key, T value, [MemoryCacheEntryOptions? options]) → T -
Available on IMemoryCache, provided by the MemoryCacheExtensions extension
Sets the value forkey. -
toString(
) → String -
A string representation of this object.
inherited
-
tryGetValue<
T> (Object key, void setValue(T? value)) → bool -
Gets the value associated with
keyif it exists.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited