MemoryCache Classe

Definição

Uma implementação de IMemoryCache usando um dicionário para armazenar suas entradas.An implementation of IMemoryCache using a dictionary to store its entries.

public ref class MemoryCache : IDisposable, Microsoft::Extensions::Caching::Memory::IMemoryCache
public class MemoryCache : IDisposable, Microsoft.Extensions.Caching.Memory.IMemoryCache
type MemoryCache = class
    interface IMemoryCache
    interface IDisposable
Public Class MemoryCache
Implements IDisposable, IMemoryCache
Herança
MemoryCache
Implementações

Construtores

MemoryCache(IOptions<MemoryCacheOptions>)

Cria uma nova instância MemoryCache.Creates a new MemoryCache instance.

MemoryCache(IOptions<MemoryCacheOptions>, ILoggerFactory)

Cria uma nova instância MemoryCache.Creates a new MemoryCache instance.

Propriedades

Count

Obtém a contagem das entradas atuais para fins de diagnóstico.Gets the count of the current entries for diagnostic purposes.

Métodos

Compact(Double)
CreateEntry(Object)

Cria ou substitui uma entrada no cache.Creates or overwrites an entry in the cache.

Dispose()

Realiza tarefas definidas pelo aplicativo associadas à liberação ou à redefinição de recursos não gerenciados.Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Dispose(Boolean)
Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
Finalize()

Limpa os eventos de coleção em segundo plano.Cleans up the background collection events.

GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
Remove(Object)

Remove o objeto associado à chave especificada.Removes the object associated with the given key.

ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Herdado de Object)
TryGetValue(Object, Object)

Obtém o item associado a essa chave, se presente.Gets the item associated with this key if present.

Métodos de Extensão

Get(IMemoryCache, Object)
Get<TItem>(IMemoryCache, Object)
GetOrCreate<TItem>(IMemoryCache, Object, Func<ICacheEntry,TItem>)
GetOrCreateAsync<TItem>(IMemoryCache, Object, Func<ICacheEntry,Task<TItem>>)
Set<TItem>(IMemoryCache, Object, TItem)
Set<TItem>(IMemoryCache, Object, TItem, MemoryCacheEntryOptions)
Set<TItem>(IMemoryCache, Object, TItem, IChangeToken)
Set<TItem>(IMemoryCache, Object, TItem, DateTimeOffset)
Set<TItem>(IMemoryCache, Object, TItem, TimeSpan)
TryGetValue<TItem>(IMemoryCache, Object, TItem)

Aplica-se a