Skip to content

Instantly share code, notes, and snippets.

@tawman
Created January 18, 2013 15:48
Show Gist options
  • Save tawman/4565494 to your computer and use it in GitHub Desktop.
Save tawman/4565494 to your computer and use it in GitHub Desktop.
Sliding and Absolute expiration in a dedicated Azure cache worker role question
public class AzureCacheFactory : IAzureCacheFactory
{
private readonly DataCache _cache;
private readonly DataCache _absoluteCache;
public AzureCacheFactory()
{
var factory = new DataCacheFactory();
_cache = factory.GetDefaultCache();
_absoluteCache = factory.GetCache("AbsoluteCache");
}
}
// GetDefaultCache returns the default cache with SlidingExpiration
// ((System.Configuration.ConfigurationElement)(_cache.Configuration))
// {Cache Name : Version : 0 Secondaries : 0 MinSecondaries : 0 SystemRegionCount : 32 EvictionType : Lru ExpirationType : SlidingExpiration IsExpirable : True DefaultTTL : 0 Enabled : True MemcacheSocketPort : 0 CacheSizeInMB : 256 ConnectionQuota : 10 DataTransferQuota : 2880 TransactionQuota : 810000} Microsoft.ApplicationServer.Caching.NamedCacheConfiguration
// GetCache("AbsoluteCache") returns the AbsoluteExpiration
// ((System.Configuration.ConfigurationElement)(_absoluteCache.Configuration))
// {Cache Name : Version : 0 Secondaries : 0 MinSecondaries : 0 SystemRegionCount : 32 EvictionType : Lru ExpirationType : AbsoluteExpiration IsExpirable : True DefaultTTL : 0 Enabled : True MemcacheSocketPort : 0 CacheSizeInMB : 256 ConnectionQuota : 10 DataTransferQuota : 2880 TransactionQuota : 810000} System.Configuration.ConfigurationElement {Microsoft.ApplicationServer.Caching.NamedCacheConfiguration}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment