Working with Regions and Tags
var dcf = new DataCacheFactory(); //get the cache named "TestCache" var cache = dcf.GetCache("TestCache"); //Add a region named "region1" - returns false //if already exists var ret = cache.CreateRegion("region1", false);
public DataCacheItemVersion Add(string key, object value, string region); public DataCacheItemVersion Add(string key, object value, TimeSpan timeout, string region); public DataCacheItemVersion Put(string key, object value, string region); public DataCacheItemVersion Put(string key, object value, TimeSpan timeout, string region); Parameterdescription keyKey of item in the distributed cache valueValue of object stored in the cache (serialized) timeoutHow long before the item should expire regionNamed region to place item
namespace Microsoft.ApplicationServer.Caching { public sealed class DataCacheItem { public DataCacheItem(); public string CacheName { get; internal set; } public string Key { get; } public string RegionName { get; internal set; } public ReadOnlyCollection Tags { get; } public TimeSpan Timeout { get; } public object Value { get; internal set; } public DataCacheItemVersion Version { get; } }
public DataCacheItemVersion Add(string key, object value, IEnumerable tags); public DataCacheItemVersion Add(string key, object value, IEnumerable tags, string region); public DataCacheItemVersion Add(string key, object value, TimeSpan timeout, IEnumerable tags); public DataCacheItemVersion Add(string key, object value, TimeSpan timeout, IEnumerable tags, string region); public DataCacheItemVersion Put(string key, object value, IEnumerable tags); public DataCacheItemVersion Put(string key, object value, IEnumerable tags, string region); public DataCacheItemVersion Put(string key, object value, TimeSpan timeout, IEnumerable tags); public DataCacheItemVersion Put(string key, object value, TimeSpan timeout, IEnumerable tags, string region);
public IEnumerable > GetObjectsByAllTags(IEnumerable tags, string region); public IEnumerable > GetObjectsByAnyTag(IEnumerable tags, string region); public IEnumerable > GetObjectsByTag(DataCacheTag tag, string region); public IEnumerable > GetObjectsInRegion(string region);