Пример #1
0
        /// <summary>
        /// Creates a cache implementation for the strategy as defined by the cache descriptor.
        /// </summary>
        /// <param name="cacheDesc">cache descriptor</param>
        /// <param name="epStatementAgentInstanceHandle">statement handle for timer invocations</param>
        /// <param name="schedulingService">scheduling service for time-based caches</param>
        /// <param name="scheduleBucket">for ordered timer invokation</param>
        /// <param name="statementContext">statement context</param>
        /// <param name="streamNum">stream number</param>
        /// <returns>data cache implementation</returns>
        public DataCache GetDataCache(ConfigurationDataCache cacheDesc,
                                      StatementContext statementContext,
                                      EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
                                      SchedulingService schedulingService,
                                      ScheduleBucket scheduleBucket,
                                      int streamNum)
        {
            if (cacheDesc == null)
            {
                return(new DataCacheNullImpl());
            }

            if (cacheDesc is ConfigurationLRUCache)
            {
                ConfigurationLRUCache lruCache = (ConfigurationLRUCache)cacheDesc;
                return(new DataCacheLRUImpl(lruCache.Size));
            }

            if (cacheDesc is ConfigurationExpiryTimeCache)
            {
                ConfigurationExpiryTimeCache expCache = (ConfigurationExpiryTimeCache)cacheDesc;
                return(MakeTimeCache(expCache, statementContext, epStatementAgentInstanceHandle, schedulingService, scheduleBucket, streamNum));
            }

            throw new IllegalStateException("Cache implementation class not configured");
        }
Пример #2
0
        /// <summary>Creates a cache implementation for the strategy as defined by the cache descriptor. </summary>
        /// <param name="cacheDesc">cache descriptor</param>
        /// <param name="epStatementAgentInstanceHandle">statement handle for timer invocations</param>
        /// <param name="schedulingService">scheduling service for time-based caches</param>
        /// <param name="scheduleBucket">for ordered timer invokation</param>
        /// <returns>data cache implementation</returns>
        public static DataCache GetDataCache(ConfigurationDataCache cacheDesc,
                                             EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
                                             SchedulingService schedulingService,
                                             ScheduleBucket scheduleBucket)
        {
            if (cacheDesc == null)
            {
                return(new DataCacheNullImpl());
            }

            if (cacheDesc is ConfigurationLRUCache)
            {
                ConfigurationLRUCache lruCache = (ConfigurationLRUCache)cacheDesc;
                return(new DataCacheLRUImpl(lruCache.Size));
            }

            if (cacheDesc is ConfigurationExpiryTimeCache)
            {
                ConfigurationExpiryTimeCache expCache = (ConfigurationExpiryTimeCache)cacheDesc;
                return(new DataCacheExpiringImpl(expCache.MaxAgeSeconds, expCache.PurgeIntervalSeconds, expCache.CacheReferenceType,
                                                 schedulingService, scheduleBucket.AllocateSlot(), epStatementAgentInstanceHandle));
            }

            throw new IllegalStateException("Cache implementation class not configured");
        }