ObjectCache.Set Método
Definição
Quando substituído em uma classe derivada, insere uma entrada de cache no cache.When overridden in a derived class, inserts a cache entry into the cache.
Sobrecargas
| Set(CacheItem, CacheItemPolicy) |
Quando substituído em uma classe derivada, insere uma entrada de cache no cache como uma instância CacheItem, especificando informações sobre como a entrada será removida.When overridden in a derived class, inserts the cache entry into the cache as a CacheItem instance, specifying information about how the entry will be evicted. |
| Set(String, Object, DateTimeOffset, String) |
Quando substituído em uma classe derivada, insere uma entrada de cache no cache, especificando detalhes de expiração com base em tempo.When overridden in a derived class, inserts a cache entry into the cache, specifying time-based expiration details. |
| Set(String, Object, CacheItemPolicy, String) |
Quando substituído em uma classe derivada, insere uma entrada de cache no cache.When overridden in a derived class, inserts a cache entry into the cache. |
Comentários
O comportamento típico dos Set métodos de sobrecarga é uma operação de inserção ou atualização.The typical behavior of the Set overload methods is an insert-or-update operation. Uma entrada de cache será inserida como uma nova entrada se a entrada especificada não existir ou a entrada de cache será atualizada com um novo valor, se já existir.A cache entry is either inserted as a new entry if the specified entry does not exist, or the cache entry is updated with a new value if it already exists.
Set(CacheItem, CacheItemPolicy)
Quando substituído em uma classe derivada, insere uma entrada de cache no cache como uma instância CacheItem, especificando informações sobre como a entrada será removida.When overridden in a derived class, inserts the cache entry into the cache as a CacheItem instance, specifying information about how the entry will be evicted.
public:
abstract void Set(System::Runtime::Caching::CacheItem ^ item, System::Runtime::Caching::CacheItemPolicy ^ policy);
public abstract void Set (System.Runtime.Caching.CacheItem item, System.Runtime.Caching.CacheItemPolicy policy);
abstract member Set : System.Runtime.Caching.CacheItem * System.Runtime.Caching.CacheItemPolicy -> unit
Public MustOverride Sub Set (item As CacheItem, policy As CacheItemPolicy)
Parâmetros
- item
- CacheItem
O item de cache a adicionar.The cache item to add.
- policy
- CacheItemPolicy
Um objeto que contém os detalhes da remoção da entrada de cache.An object that contains eviction details for the cache entry. Esse objeto fornece mais opções de remoção do que uma expiração absoluta simples.This object provides more options for eviction than a simple absolute expiration.
Comentários
Se a chave para item não existir, item será inserida como uma nova entrada de cache.If the key for item does not exist, item is inserted as a new cache entry. Se um item com uma chave correspondente item existir, o valor de item será usado para atualizar ou substituir o valor da entrada de cache existente.If an item with a key that matches item exists, the value from item is used to update or overwrite the value of the existing cache entry.
Aplica-se a
Set(String, Object, DateTimeOffset, String)
Quando substituído em uma classe derivada, insere uma entrada de cache no cache, especificando detalhes de expiração com base em tempo.When overridden in a derived class, inserts a cache entry into the cache, specifying time-based expiration details.
public abstract void Set (string key, object value, DateTimeOffset absoluteExpiration, string regionName = default);
abstract member Set : string * obj * DateTimeOffset * string -> unit
Public MustOverride Sub Set (key As String, value As Object, absoluteExpiration As DateTimeOffset, Optional regionName As String = Nothing)
Parâmetros
- key
- String
Um identificador exclusivo da entrada de cache.A unique identifier for the cache entry.
- value
- Object
O objeto a ser inserido.The object to insert.
- absoluteExpiration
- DateTimeOffset
A data e a hora fixas em que a entrada de cache vai expirar.The fixed date and time at which the cache entry will expire.
- regionName
- String
Opcional.Optional. Uma região nomeada no cache à qual a entrada de cache pode ser adicionada, se as regiões forem implementadas.A named region in the cache to which the cache entry can be added, if regions are implemented. O valor padrão do parâmetro opcional é null.The default value for the optional parameter is null.
Comentários
Se um item que corresponde key não existir no cache value e key for usado para inserir como uma nova entrada de cache.If an item that matches key does not exist in the cache, value and key are used to insert as a new cache entry. Se um item com uma chave correspondente item existir, a entrada de cache será atualizada ou substituída usando value .If an item with a key that matches item exists, the cache entry is updated or overwritten by using value.
Aplica-se a
Set(String, Object, CacheItemPolicy, String)
Quando substituído em uma classe derivada, insere uma entrada de cache no cache.When overridden in a derived class, inserts a cache entry into the cache.
public abstract void Set (string key, object value, System.Runtime.Caching.CacheItemPolicy policy, string regionName = default);
abstract member Set : string * obj * System.Runtime.Caching.CacheItemPolicy * string -> unit
Public MustOverride Sub Set (key As String, value As Object, policy As CacheItemPolicy, Optional regionName As String = Nothing)
Parâmetros
- key
- String
Um identificador exclusivo da entrada de cache.A unique identifier for the cache entry.
- value
- Object
O objeto a ser inserido.The object to insert.
- policy
- CacheItemPolicy
Um objeto que contém os detalhes da remoção da entrada de cache.An object that contains eviction details for the cache entry. Esse objeto fornece mais opções de remoção do que uma expiração absoluta simples.This object provides more options for eviction than a simple absolute expiration.
- regionName
- String
Opcional.Optional. Uma região nomeada no cache à qual a entrada de cache pode ser adicionada, se as regiões forem implementadas.A named region in the cache to which the cache entry can be added, if regions are implemented. O valor padrão do parâmetro opcional é null.The default value for the optional parameter is null.
Comentários
Essa sobrecarga de método permite que você forneça mais detalhes de remoção ou expiração do que os que estão disponíveis na expiração absoluta baseada em tempo.This method overload lets you provide more eviction or expiration details than those that are available in time-based absolute expiration.
Se um item que corresponde key não existir no cache value e key for usado para inserir como uma nova entrada de cache.If an item that matches key does not exist in the cache, value and key are used to insert as a new cache entry. Se um item com uma chave correspondente item existir, a entrada de cache será atualizada ou substituída usando value .If an item with a key that matches item exists, the cache entry is updated or overwritten by using value.