protected HistoricalDataCache MakeTimeCache( ConfigurationCommonCacheExpiryTime expCache, AgentInstanceContext agentInstanceContext, int streamNum, int scheduleCallbackId) { return new HistoricalDataCacheExpiringImpl( expCache.MaxAgeSeconds, expCache.PurgeIntervalSeconds, expCache.CacheReferenceType, agentInstanceContext, agentInstanceContext.ScheduleBucket.AllocateSlot()); }
/// <summary> /// Creates a cache implementation for the strategy as defined by the cache descriptor. /// </summary> /// <param name="cacheDesc">cache descriptor</param> /// <param name="agentInstanceContext">agent instance context</param> /// <param name="streamNum">stream number</param> /// <param name="scheduleCallbackId">callback id</param> /// <returns>data cache implementation</returns> public HistoricalDataCache GetDataCache( ConfigurationCommonCache cacheDesc, AgentInstanceContext agentInstanceContext, int streamNum, int scheduleCallbackId) { if (cacheDesc == null) { return new HistoricalDataCacheNullImpl(); } if (cacheDesc is ConfigurationCommonCacheLRU) { ConfigurationCommonCacheLRU lruCache = (ConfigurationCommonCacheLRU) cacheDesc; return new HistoricalDataCacheLRUImpl(lruCache.Size); } if (cacheDesc is ConfigurationCommonCacheExpiryTime) { ConfigurationCommonCacheExpiryTime expCache = (ConfigurationCommonCacheExpiryTime) cacheDesc; return MakeTimeCache(expCache, agentInstanceContext, streamNum, scheduleCallbackId); } throw new IllegalStateException("Cache implementation class not configured"); }