Collapse All Expand All

C#

Oracle® Coherence .NET API Reference
CompositeCache..::.Insert Method (Object, Object, Int64)
CompositeCache Class See Also Send Feedback

Oracle® Coherence .NET API Reference Release 3.6
E15727-01
Associates the specified value with the specified key in this cache.

Namespace: Tangosol.Net.Cache
Assembly: Coherence (in Coherence.dll) Version: 3.6.0.0 (3.6.0.0)

# Syntax

C#
    public virtual Object Insert(
    	Object key,
    	Object value,
    	long millis
    )

#### Parameters

key
  Type: System..::.Object
  Key with which the specified value is to be associated.

value
  Type: System..::.Object
  Value to be associated with the specified key.

millis
  Type: System..::.Int64
  The number of milliseconds until the cache entry will expire, also referred to as the entry's "time to live"; pass DEFAULT to use the cache's default time-to-live setting; pass NEVER to indicate that the cache entry should never expire; this milliseconds value is not a date/time value, but the amount of time object will be kept in the cache.

#### Return Value

Previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the cache previously associated null with the specified key, if the implementation supports null values.

#### Implements

ICache..::.Insert(Object, Object, Int64)

# Remarks

If the cache previously contained a mapping for this key, the old value is replaced.

This variation of the Insert(Object, Object) method allows the caller to specify an expiry (or "time to live") for the cache entry.

# Exceptions

Exception | Condition
--- | ---
System..::.NotSupportedException | If the requested expiry is a positive value and the implementation does not support expiry of cache entries.

# See Also

CompositeCache Class
Insert Overload
Tangosol.Net.Cache Namespace