CacheExtensions.Get Method

Definition

Overloads

Get(IMemoryCache, Object)

Gets the value associated with this key if present.

Get<TItem>(IMemoryCache, Object)

Gets the value associated with this key if present.

Get(IMemoryCache, Object)

Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs

Gets the value associated with this key if present.

C#
public static object? Get(this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key);

Parameters

cache
IMemoryCache

The IMemoryCache instance this method extends.

key
Object

The key of the value to get.

Returns

The value associated with this key, or null if the key is not present.

Applies to

.NET 10 (package-provided) y otras versiones
Producto Versiones
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

Get<TItem>(IMemoryCache, Object)

Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs

Gets the value associated with this key if present.

C#
public static TItem? Get<TItem>(this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key);

Type Parameters

TItem

The type of the object to get.

Parameters

cache
IMemoryCache

The IMemoryCache instance this method extends.

key
Object

The key of the value to get.

Returns

TItem

The value associated with this key, or default(TItem) if the key is not present.

Applies to

.NET 10 (package-provided) y otras versiones
Producto Versiones
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)