/// <summary> /// Creates an <see cref="ICacheConcurrencyStrategy"/> from the parameters. /// </summary> /// <param name="usage">The name of the strategy that <see cref="ICacheProvider"/> should use for the class.</param> /// <param name="cache">The <see cref="CacheBase"/> used for this strategy.</param> /// <returns>An <see cref="ICacheConcurrencyStrategy"/> to use for this object in the <see cref="ICache"/>.</returns> public static ICacheConcurrencyStrategy CreateCache(string usage, CacheBase cache) { if (log.IsDebugEnabled()) { log.Debug("cache for: {0} usage strategy: {1}", cache.RegionName, usage); } ICacheConcurrencyStrategy ccs; switch (usage) { case ReadOnly: ccs = new ReadOnlyCache(); break; case ReadWrite: ccs = new ReadWriteCache(); break; case NonstrictReadWrite: ccs = new NonstrictReadWriteCache(); break; //case CacheFactory.Transactional: // ccs = new TransactionalCache(); // break; default: throw new MappingException( "cache usage attribute should be read-write, read-only or nonstrict-read-write"); } ccs.Cache = cache; return(ccs); }
public UpdateTimestampsCache(Settings settings, IDictionary <string, string> props) { var prefix = settings.CacheRegionPrefix; regionName = prefix == null ? regionName : prefix + '.' + regionName; log.Info("starting update timestamps cache at region: {0}", regionName); var updateTimestamps = settings.CacheProvider.BuildCache(regionName, props); _updateTimestamps = updateTimestamps as CacheBase ?? new ObsoleteCacheWrapper(updateTimestamps); }
/// <summary> /// Build a query cache. /// </summary> /// <param name="updateTimestampsCache">The cache of updates timestamps.</param> /// <param name="regionCache">The <see cref="ICache" /> to use for the region.</param> public StandardQueryCache( UpdateTimestampsCache updateTimestampsCache, CacheBase regionCache) { if (regionCache == null) throw new ArgumentNullException(nameof(regionCache)); _regionName = regionCache.RegionName; Log.Info("starting query cache at region: {0}", _regionName); _cache = regionCache; _updateTimestampsCache = updateTimestampsCache; }
public StandardQueryCache(Settings settings, IDictionary <string, string> props, UpdateTimestampsCache updateTimestampsCache, string regionName) { if (regionName == null) { regionName = typeof(StandardQueryCache).FullName; } var prefix = settings.CacheRegionPrefix; if (!string.IsNullOrEmpty(prefix)) { regionName = prefix + '.' + regionName; } Log.Info("starting query cache at region: {0}", regionName); Cache = settings.CacheProvider.BuildCache(regionName, props); _cache = Cache as CacheBase ?? new ObsoleteCacheWrapper(Cache); _updateTimestampsCache = updateTimestampsCache; _regionName = regionName; }
/// <summary> /// Build the update timestamps cache. /// </summary>x /// <param name="cache">The <see cref="ICache" /> to use.</param> public UpdateTimestampsCache(CacheBase cache) { log.Info("starting update timestamps cache at region: {0}", cache.RegionName); _updateTimestamps = cache; }
/// <summary> /// Creates an <see cref="ICacheConcurrencyStrategy"/> from the parameters. /// </summary> /// <param name="usage">The name of the strategy that <see cref="ICacheProvider"/> should use for the class.</param> /// <param name="cache">The <see cref="CacheBase"/> used for this strategy.</param> /// <returns>An <see cref="ICacheConcurrencyStrategy"/> to use for this object in the <see cref="ICache"/>.</returns> // TODO: Since v5.4 //[Obsolete("Please use overload with a CacheBase and Settings parameters.")] public static ICacheConcurrencyStrategy CreateCache(string usage, CacheBase cache) { return(CreateCache(usage, cache, null)); }