Interface ICollectionManager
This interface contains create and get operations for all collection data types.
Assembly: Alachisoft.NCache.Client.dll
Syntax
public interface ICollectionManager
Methods
CreateDictionary<String, TValue>(String)
Creates Distributed Dictionary against the provided collection name.
Declaration
IDistributedDictionary<string, TValue> CreateDictionary<String, TValue>(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection to be created. |
Returns
Type | Description |
---|---|
IDistributedDictionary<System.String, TValue> | Interface for using Dictionary. |
Type Parameters
Name | Description |
---|---|
String | Type of Dictionary keys. |
TValue | Type of Dictionary values. |
Examples
The following code sample shows how to created a Distributed Dictionary.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedDictionary";
IDistributedDictionary<string, Product> dictionary = cache.DataTypeManager.CreateDictionary<string, Product>(dataTypeName);
CreateDictionary<String, TValue>(String, DataTypeAttributes, WriteThruOptions)
Creates Distributed Dictionary against the provided collection name and configures it, according to the provided user configuration as attributes of collection.
Declaration
IDistributedDictionary<string, TValue> CreateDictionary<String, TValue>(string key, DataTypeAttributes attributes, WriteThruOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection to be created. |
DataTypeAttributes | attributes | DataTypeAttributes for providing user configuration for this collection. |
WriteThruOptions | options | WriteThruOptions regarding updating data source. This can be WriteThru, WriteBehind or none. |
Returns
Type | Description |
---|---|
IDistributedDictionary<System.String, TValue> | Interface for using Dictionary. |
Type Parameters
Name | Description |
---|---|
String | Type of Dictionary keys. |
TValue | Type of Dictionary values. |
Examples
The following code sample shows how to created a distributed Dictionary with absolute expiration of 1 minutes.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedDictionary";
DataTypeAttributes attributes = new DataTypeAttributes();
attributes.Expiration = new Expiration(ExpirationType.Absolute, new TimeSpan(0, 1, 0));
IDistributedDictionary<string, Product> dictionary = cache.DataTypeManager.CreateDictionary<string, Product>(dataTypeName, attributes);
CreateHashSet<T>(String)
Creates Distributed Set against the provided collection name.
Declaration
IDistributedHashSet<T> CreateHashSet<T>(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection to be created. |
Returns
Type | Description |
---|---|
IDistributedHashSet<T> | Interface for using set. |
Type Parameters
Name | Description |
---|---|
T | Type of Set items. |
Examples
The following code sample shows how to created a Distributed Set.
ICache cache = CacheManager.GetCache("demoCache");
string dataTypeName = "DistributedSet";
IDistributedHashSet<int> set = cache.DataTypeManager.CreateHashSet<int>(dataTypeName);
CreateHashSet<T>(String, DataTypeAttributes, WriteThruOptions)
Creates Distributed Set against the provided collection name and configures it according to the provided user configuration as attributes of collection.
Declaration
IDistributedHashSet<T> CreateHashSet<T>(string key, DataTypeAttributes attributes, WriteThruOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection to be created. |
DataTypeAttributes | attributes | DataTypeAttributes for providing user configuration for this collection. |
WriteThruOptions | options | WriteThruOptions regarding updating data source. This can be WriteThru, WriteBehind or none. |
Returns
Type | Description |
---|---|
IDistributedHashSet<T> | Interface for using set. |
Type Parameters
Name | Description |
---|---|
T | Type of Set items. |
Examples
The following code sample shows how to created a Distributed Set with absolute expiration of 1 minutes.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedSet";
DataTypeAttributes attributes = new DataTypeAttributes();
attributes.Expiration = new Expiration(ExpirationType.Absolute, new TimeSpan(0, 1, 0));
IDistributedHashSet<int> set = cache.DataTypeManager.CreateHashSet<int>(dataTypeName, attributes);
CreateList<T>(String)
Creates Distributed List against the provided collection name.
Declaration
IDistributedList<T> CreateList<T>(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection to be created. |
Returns
Type | Description |
---|---|
IDistributedList<T> | Interface for using List. |
Type Parameters
Name | Description |
---|---|
T | Type of List items. |
Examples
The following code sample shows how to created a Distributed List.
ICache cache = CacheManager.GetCache("demoCache");
string dataTypeName = "DistributedList";
IDistributedLis<Product> list = cache.DataTypeManager.CreateList<Product>(dataTypeName);
CreateList<T>(String, DataTypeAttributes, WriteThruOptions)
Creates Distributed List against the provided collection name and configures it according to the provided user configuration as attributes of collection.
Declaration
IDistributedList<T> CreateList<T>(string key, DataTypeAttributes attributes, WriteThruOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection to be created. |
DataTypeAttributes | attributes | DataTypeAttributes for providing user configuration for this collection. |
WriteThruOptions | options | WriteThruOptions regarding updating data source.This can be WriteThru, WriteBehind or none. |
Returns
Type | Description |
---|---|
IDistributedList<T> | Interface for using List |
Type Parameters
Name | Description |
---|---|
T | Type of List items. |
Examples
The following code sample shows how to created a Distributed List with absolute expiration of 1 minutes.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedList";
DataTypeAttributes attributes = new DataTypeAttributes();
attributes.Expiration = new Expiration(ExpirationType.Absolute, new TimeSpan(0, 1, 0));
IDistributedLis<Product> list = cache.DataTypeManager.CreateList<Product>(dataTypeName,attributes);
CreateQueue<T>(String)
Creates Distributed Queue against the provided collection name.
Declaration
IDistributedQueue<T> CreateQueue<T>(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection to be created. |
Returns
Type | Description |
---|---|
IDistributedQueue<T> | Interface for using Queue. |
Type Parameters
Name | Description |
---|---|
T | Type of Queue items. |
Examples
The following code sample shows how to create a Distributed Queue.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedQueue";
IDistributedQueue<Product> queue = cache.DataTypeManager.CreateQueue<Product>(dataTypeName);
CreateQueue<T>(String, DataTypeAttributes, WriteThruOptions)
Creates Distributed Queue against the provided collection name and configures it according to the provided user configuration as attributes of collection.
Declaration
IDistributedQueue<T> CreateQueue<T>(string key, DataTypeAttributes attributes, WriteThruOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection to be created |
DataTypeAttributes | attributes | DataTypeAttributes for providing user configuration for this collection. |
WriteThruOptions | options | WriteThruOptions regarding updating data source. This can be WriteThru, WriteBehind or none. |
Returns
Type | Description |
---|---|
IDistributedQueue<T> | Interface for using Queue. |
Type Parameters
Name | Description |
---|---|
T | Type of Queue items. |
Examples
The following code sample shows how to create a Distributed Queue with absoulte expiration of 1 minutes.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedQueue";
DataTypeAttributes attributes = new DataTypeAttributes();
attributes.Expiration = new Expiration(ExpirationType.Absolute, new TimeSpan(0, 1, 0));
IDistributedQueue<Product> queue = cache.DataTypeManager.CreateQueue<Product>(dataTypeName, attributes);
GetDictionary<String, TValue>(String, ReadThruOptions)
Gets Distributed Dictionary interface against the provided collection name.
Declaration
IDistributedDictionary<string, TValue> GetDictionary<String, TValue>(string key, ReadThruOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection. |
ReadThruOptions | options | ReadThruOptions to read from data source. These can be either ReadThru, ReadThruForced or none. |
Returns
Type | Description |
---|---|
IDistributedDictionary<System.String, TValue> | Interface for using Dictionary. |
Type Parameters
Name | Description |
---|---|
String | Type of Dictionary keys. |
TValue | Type of Dictionary values. |
Examples
The following code sample shows how to get a Distributed Dictionary handler from cache.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedQueue";
IDistributedDictionary<string, Product> dictionary = cache.DataTypeManager.GetDictionary<string, Product>(dataTypeName);
GetHashSet<T>(String, ReadThruOptions)
Gets Distributed Set interface against the provided collection name.
Declaration
IDistributedHashSet<T> GetHashSet<T>(string key, ReadThruOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection. |
ReadThruOptions | options | ReadThruOptions to read from data source. These can be either ReadThru, ReadThruForced or none. |
Returns
Type | Description |
---|---|
IDistributedHashSet<T> | Interface for using set. |
Type Parameters
Name | Description |
---|---|
T | Type of Set items. |
Examples
The following code sample shows how to get a Distributed Set handler from cache.
ICache cache = CacheManager.GetCache("demoCache");
string dataTypeName = "DistributedSet";
IDistributedHashSet<int> set = cache.DataTypeManager.GetHashSet<int>(dataTypeName);
GetList<T>(String, ReadThruOptions)
Gets Distributed List interface against the provided collection name.
Declaration
IDistributedList<T> GetList<T>(string key, ReadThruOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection. |
ReadThruOptions | options | ReadThruOptions to read from data source. These can be either ReadThru, ReadThruForced or none. |
Returns
Type | Description |
---|---|
IDistributedList<T> | Interface for using List. |
Type Parameters
Name | Description |
---|---|
T | Type of List items. |
Examples
The following code sample shows how to get a Distributed List handler from cache.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedList";
IDistributedList<Product> list = cache.DataTypeManager.GetList<Product>(dataTypeName);
GetQueue<T>(String, ReadThruOptions)
Gets Distributed Queue interface against the provided collection name.
Declaration
IDistributedQueue<T> GetQueue<T>(string key, ReadThruOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of collection to be created. |
ReadThruOptions | options | ReadThruOptions to read from data source. These can be either ReadThru, ReadThruForced or none. |
Returns
Type | Description |
---|---|
IDistributedQueue<T> | Interface for using Queue. |
Type Parameters
Name | Description |
---|---|
T | Type of Queue items. |
Examples
The following code sample shows how to get a Distributed Queue handler from cache.
ICache cache = CacheManager.GetCache("demoCache");
string dataTypeName = "DistributedQueue";
IDistributedQueue<Product> queue = cache.DataTypeManager.GetQueue<Product>(dataTypeName);