Partager via


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.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Get(Microsoft::Extensions::Caching::Memory::IMemoryCache ^ cache, System::Object ^ key);
public static object? Get (this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key);
static member Get : Microsoft.Extensions.Caching.Memory.IMemoryCache * obj -> obj
<Extension()>
Public Function Get (cache As IMemoryCache, key As Object) As Object

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

Get<TItem>(IMemoryCache, Object)

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

Gets the value associated with this key if present.

public:
generic <typename TItem>
[System::Runtime::CompilerServices::Extension]
 static TItem Get(Microsoft::Extensions::Caching::Memory::IMemoryCache ^ cache, System::Object ^ key);
public static TItem? Get<TItem> (this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key);
static member Get : Microsoft.Extensions.Caching.Memory.IMemoryCache * obj -> 'Item
<Extension()>
Public Function Get(Of TItem) (cache As IMemoryCache, key As Object) As TItem

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