Class NullImplementation.NullCache
A ICache that contains nothing and does nothing.
Inheritance
Inherited Members
Namespace: Tangosol.Util
Assembly: Coherence.dll
Syntax
public class NullImplementation.NullCache : NullImplementation.NullCollection, IPortableObject, ICache, IDictionary, ICollection, IEnumerable
Fields
Instance
Since the cache contains no information, only one ever has to exist.
Declaration
public static readonly ICache Instance
Field Value
Type | Description |
---|---|
ICache |
Properties
Entries
Gets a collection of ICacheEntry instances within the cache.
Declaration
public ICollection Entries { get; }
Property Value
Type | Description |
---|---|
ICollection |
IsFixedSize
Gets a value indicating whether the dictionary object has a fixed size.
Declaration
public bool IsFixedSize { get; }
Property Value
Type | Description |
---|---|
bool | true if the dictionary object has a fixed size; otherwise, false. |
IsReadOnly
Gets a value indicating whether the dictionary object is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
bool | true if the dictionary object is read-only; otherwise, false. |
this[object]
Gets or sets the element with the specified key.
Declaration
public object this[object key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
object | key | The key of the element to get or set. |
Property Value
Type | Description |
---|---|
object | The element with the specified key. |
Keys
Gets an ICollection object containing the keys of the dictionary.
Declaration
public ICollection Keys { get; }
Property Value
Type | Description |
---|---|
ICollection | An ICollection object containing the keys of the dictionary. |
Values
Gets an ICollection object containing the values in the dictionary.
Declaration
public ICollection Values { get; }
Property Value
Type | Description |
---|---|
ICollection | An ICollection object containing the values in the dictionary. |
Methods
Add(object, object)
Adds an element with the provided key and value to the dictionary.
Declaration
public void Add(object key, object value)
Parameters
Type | Name | Description |
---|---|---|
object | key | The object to use as the key of the element to add. |
object | value | The object to use as the value of the element to add. |
Clear()
Removes all elements from the dictionary.
Declaration
public void Clear()
Contains(object)
Determines whether the dictionary object contains an element with the specified key.
Declaration
public bool Contains(object key)
Parameters
Type | Name | Description |
---|---|---|
object | key | The key to locate in the dictionary. |
Returns
Type | Description |
---|---|
bool | true if the dictionary contains an element with the key; otherwise, false. |
GetAll(ICollection)
Get the values for all the specified keys, if they are in the cache.
Declaration
public IDictionary GetAll(ICollection keys)
Parameters
Type | Name | Description |
---|---|---|
ICollection | keys | A collection of keys that may be in the named cache. |
Returns
Type | Description |
---|---|
IDictionary | A dictionary of keys to values for the specified keys passed in
|
Remarks
For each key that is in the cache, that key and its corresponding value will be placed in the dictionary that is returned by this method. The absence of a key in the returned dictionary indicates that it was not in the cache, which may imply (for caches that can load behind the scenes) that the requested data could not be loaded.
The result of this method is defined to be semantically the same as the following implementation, without regards to threading issues:
IDictionary dict = new AnyDictionary(); // could be a Hashtable (but does not have to) foreach (object key in colKeys) { object value = this[key]; if (value != null || Contains(key)) { dict[key] = value; } } return dict;
Insert(object, object)
Associates the specified value with the specified key in this cache.
Declaration
public object Insert(object key, object value)
Parameters
Type | Name | Description |
---|---|---|
object | key | Key with which the specified value is to be associated. |
object | value | Value to be associated with the specified key. |
Returns
Type | Description |
---|---|
object | Previous value associated with specified key, or |
Remarks
If the cache previously contained a mapping for this key, the old value is replaced.
Invoking this method is equivalent to the following call:
Insert(key, value, CacheExpiration.Default);
Insert(object, object, long)
Associates the specified value with the specified key in this cache.
Declaration
public object Insert(object key, object value, long millis)
Parameters
Type | Name | Description |
---|---|---|
object | key | Key with which the specified value is to be associated. |
object | value | Value to be associated with the specified key. |
long | millis | 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. |
Returns
Type | Description |
---|---|
object | Previous value associated with specified key, or |
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
Type | Condition |
---|---|
NotSupportedException | If the requested expiry is a positive value and the implementation does not support expiry of cache entries. |
InsertAll(IDictionary)
Copies all of the mappings from the specified dictionary to this cache (optional operation).
Declaration
public void InsertAll(IDictionary dictionary)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | Mappings to be stored in this cache. |
Remarks
These mappings will replace any mappings that this cache had for any of the keys currently in the specified dictionary.
Exceptions
Type | Condition |
---|---|
InvalidCastException | If the class of a key or value in the specified dictionary prevents it from being stored in this cache. |
InvalidOperationException | If the lock could not be succesfully obtained for some key. |
NullReferenceException | This cache does not permit |
Remove(object)
Removes the element with the specified key from the dictionary.
Declaration
public void Remove(object key)
Parameters
Type | Name | Description |
---|---|---|
object | key | The key of the element to remove. |