Download presentation
Presentation is loading. Please wait.
1
Working with Regions and Tags
3
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);
4
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
6
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; } }
8
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);
9
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);
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.