Created
January 18, 2013 15:48
-
-
Save tawman/4565494 to your computer and use it in GitHub Desktop.
Sliding and Absolute expiration in a dedicated Azure cache worker role question
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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