Interface ICacheService
An ICacheService is a service providing a collection of named caches that hold resources.
Inherited Members
Namespace: Tangosol.Net
Assembly: Coherence.dll
Syntax
public interface ICacheService : IService, IService, IControllable
Remarks
These resources are expected to be managed in memory, and are typically composed of data that are also stored persistently in a database, or data that have been assembled or calculated at some significant cost, thus these resources are referred to as cached.
Properties
CacheNames
A collection of string objects, one for each cache name that has been previously registered with this ICacheService.
Declaration
ICollection CacheNames { get; }
Property Value
Type | Description |
---|---|
ICollection | ICollection of cache names. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the service is not running or has stopped. |
Methods
DestroyCache(INamedCache)
Release and destroy the specified cache.
Declaration
void DestroyCache(INamedCache cache)
Parameters
Type | Name | Description |
---|---|---|
INamedCache | cache | The cache object to be released. |
Remarks
Warning: This method is used to completely destroy the specified cache across the cluster. All references in the entire cluster to this cache will be invalidated, the cached data will be cleared, and all resources will be released.
See Also
EnsureCache(string)
Obtain an INamedCache interface that provides a view of cached resources.
Declaration
INamedCache EnsureCache(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name, within this ICacheService, that uniquely identifies a
view; |
Returns
Type | Description |
---|---|
INamedCache | An INamedCache interface which can be used to access the resources of the specified view. |
Remarks
The view is identified by name within this ICacheService. Typically, repeated calls to this method with the same view name will result in the same view reference being returned.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the service is not running. |
ReleaseCache(INamedCache)
Release local resources associated with the specified instance of the cache.
Declaration
void ReleaseCache(INamedCache cache)
Parameters
Type | Name | Description |
---|---|---|
INamedCache | cache | The cache object to be released. |
Remarks
This invalidates a reference obtained by using the EnsureCache(string) method.
Releasing a reference to a cache makes the cache reference no longer usable, but does not affect the cache itself. In other words, all other references to the cache will still be valid, and the cache data is not affected by releasing the reference.
The reference that is released using this method can no longer be used; any attempt to use the reference will result in an exception.