Interface ICache
This interface contians the services and methods that are used to perform operations on the cache.
Namespace:
Assembly: Alachisoft.NCache.Client.dll
Syntax
public interface ICache : IDisposable, IEnumerable
Properties
Name | Description |
---|---|
ClientInfo | Displays the information related to this client. |
ConnectedClientList | Gets the information of all connected clients to the cache. |
Count | Gets the number of items stored in the cache. |
DataTypeManager | Gets an instance of IDataTypeManager. |
ExecutionService | Gets an instance of IExecutionService. |
MessagingService | Gets an instance of IMessagingService. |
NotificationService | Gets an instance of INotificationService. |
SearchService | Gets an instance of ISearchService. |
Methods
Name | Description |
---|---|
Add(String, CacheItem, WriteThruOptions) | Adds a CacheItem to the cache. It also lets you specify the WriteThruOptions. Using CacheItem, you can also specify properties for the cache items, for e.g., expiration and priority. |
Add(String, Object) | Adds an item into the Cache object with a cache key to reference its location. |
AddAsync(String, CacheItem, WriteThruOptions) | Adds a CacheItem into the cache asynchronously with a cache key to reference its location and WriteThruOptions. |
AddAsync(String, Object) | Adds an object into the cache asynchronously with a cache key to reference its location. |
AddBulk(IDictionary<String, CacheItem>, WriteThruOptions) | Adds a dictionary of cache keys with CacheItem to the cache with the WriteThruOptions. The CacheItem contains properties to associate with the item, like expiration, dependencies and eviction information. |
Clear() | Removes all elements from the ICache. |
ClearClientCache() | Removes all elements from the client cache. |
Contains(String) | Determines whether the cache contains a specific key. |
ContainsBulk(IEnumerable<String>) | Determines whether the cache contains specifiec keys. |
Get<T>(String, ref CacheItemVersion, ReadThruOptions) | Retrieves the specified item from the Cache object, with read-through caching option available. If the option of read-through has been set, the object will be fetched from the data source if it does not exist in cache. It accepts the CacheItemVersion by reference. If null is passed for CacheItemVersion, then the version of the object from the cache is returned. If non-null CacheItemVersion is passed, then object is returned from the cache only if that is the current version of the object in the cache. |
Get<T>(String, ReadThruOptions) | Retrieves the specified item from the Cache object, with read-through caching option available. If the option of read-through has been set, the object will be fetched from the data source if it does not exist in cache. |
Get<T>(String, Boolean, TimeSpan, ref LockHandle) | Retrieves the specified item from the Cache if it is not already locked. Otherwise it returns null. This is different from the basic Get operation where an item is returned ignoring the lock altogether. |
GetBulk<T>(IEnumerable<String>, ReadThruOptions) | Retrieves the objects from cache for the given keys as key-value pairs. Options regarding reading from data source (read-through) can be set. |
GetCacheItem(String, ref CacheItemVersion, ReadThruOptions) | Retrieves the specified CacheItem from the Cache object. This overload also allows specifying the read-through option. if read-through is set and the object does not exist in the cache, the object will be fetched from the data source and added to the cache. It accepts the CacheItemVersion by reference. If null is passed for CacheItemVersion, then the version of the object from the cache is returned. If non-null CacheItemVersion is passed, then object is returned from the cache only if that is the current version of the object in the cache. |
GetCacheItem(String, ReadThruOptions) | Retrieves the specified CacheItem from the Cache object. This overload also allows specifying the read-through option. If read-through is set and the object does not exist in the cache, the object will be fetched from the data source and added to the cache. |
GetCacheItem(String, Boolean, TimeSpan, ref LockHandle) | Get the cache item stored in cache. Loack handle can be given with this and a flag can be set if you want to acquire lock. |
GetCacheItemBulk(IEnumerable<String>, ReadThruOptions) | Retrieves the specified CacheItems from the Cache object. This overload also allows specifying the read-through option. If read-through is set and the object does not exist in the cache, the object will be fetched from the data source and added to the cache. |
GetCacheStream(String, CacheStreamAttributes) | Gets an instance CacheStream |
GetIfNewer<T>(String, ref CacheItemVersion) | Gets an object from the cache only if a newer version of the object exists in cache. |
GetJsonEnumerator() | Retrieves a dictionary enumerator used to iterate through the key settings and their values as JSON objects contained in the cache. |
Insert(String, CacheItem, WriteThruOptions, LockHandle, Boolean) | Inserts a CacheItem into the cache, allowing to specify the Write-Through option. |
Insert(String, Object) | Inserts an item (object) into the cache. |
InsertAsync(String, CacheItem, WriteThruOptions) | Inserts a CacheItem into the cache asynchronously with a cache key to reference its location and WriteThruOptions. |
InsertAsync(String, Object) | Inserts an object into the cache asynchronously with a cache key to reference its location. |
InsertBulk(IDictionary<String, CacheItem>, WriteThruOptions) | Inserts a dictionary of cache keys with CacheItem to the cache with the WriteThruOptions. The CacheItem contains properties to associate with the item, like expiration, dependencies and eviction information. |
Lock(String, TimeSpan, out LockHandle) | Acquires a lock on an item in the cache. |
Remove(String, LockHandle, CacheItemVersion, WriteThruOptions) | Removes the specified item from the ICache. You can also specify the write option such that the item may be removed from both cache and data source. If version is specified then item will only be removed if the specified version is still the most recent version in the cache. |
Remove<T>(String, out T, LockHandle, CacheItemVersion, WriteThruOptions) | Removes the specified item from the ICache and returns it to the application as an out parameter. You can also specify the write option such that the item may be removed from both cache and data source. If version is specified then item will only be removed if the specified version is still the most recent version in the cache. |
RemoveAsync<T>(String, WriteThruOptions) | Removes an item from the cache asynchronously with a cache key to reference its location and WriteThruOptions. |
RemoveBulk(IEnumerable<String>, WriteThruOptions) | Removes the specified items from the ICache. You can also specify the write option such that the items may be removed from both cache and data source. |
RemoveBulk<T>(IEnumerable<String>, out IDictionary<String, T>, WriteThruOptions) | Removes the specified items from the Alachisoft.NCache.Client.Cache and returns them to the application in the form of a dictionary as an out Parameter. |
Unlock(String, LockHandle) | Unlocks a locked cached item if the correct LockHandle is specified. If LockHandle is null Forcefully unlocks a locked cached item. |
UpdateAttributes(String, CacheItemAttributes) | Update CacheItemAttributes of an existing item in cache. |