Esempio n. 1
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="maxAgeSec">is the maximum age in seconds</param>
        /// <param name="purgeIntervalSec">is the purge interval in seconds</param>
        /// <param name="cacheReferenceType">indicates whether hard, soft or weak references are used in the cache</param>
        /// <param name="schedulingService">is a service for call backs at a scheduled time, for purging</param>
        /// <param name="scheduleSlot">slot for scheduling callbacks for this cache</param>
        /// <param name="epStatementAgentInstanceHandle">is the statements-own handle for use in registering callbacks with services</param>
        /// <param name="timeAbacus">time abacus</param>
        public DataCacheExpiringImpl(
            double maxAgeSec,
            double purgeIntervalSec,
            ConfigurationCacheReferenceType cacheReferenceType,
            SchedulingService schedulingService,
            long scheduleSlot,
            EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
            TimeAbacus timeAbacus)
        {
            _maxAgeSec         = maxAgeSec;
            _purgeIntervalSec  = purgeIntervalSec;
            _schedulingService = schedulingService;
            _scheduleSlot      = scheduleSlot;
            _timeAbacus        = timeAbacus;

            if (cacheReferenceType == ConfigurationCacheReferenceType.HARD)
            {
                _cache = new Dictionary <Object, Item>();
            }
            else if (cacheReferenceType == ConfigurationCacheReferenceType.SOFT)
            {
                _cache = new ReferenceMap <Object, Item>(ReferenceType.SOFT, ReferenceType.SOFT);
            }
            else
            {
                _cache = new WeakDictionary <Object, Item>();
            }

            _epStatementAgentInstanceHandle = epStatementAgentInstanceHandle;
        }
        /// <summary>Ctor. </summary>
        /// <param name="maxAgeSec">is the maximum age in seconds</param>
        /// <param name="purgeIntervalSec">is the purge interval in seconds</param>
        /// <param name="cacheReferenceType">indicates whether hard, soft or weak references are used in the cache</param>
        /// <param name="schedulingService">is a service for call backs at a scheduled time, for purging</param>
        /// <param name="scheduleSlot">slot for scheduling callbacks for this cache</param>
        /// <param name="epStatementAgentInstanceHandle">is the statements-own handle for use in registering callbacks with services</param>
        public DataCacheExpiringImpl(double maxAgeSec,
                                     double purgeIntervalSec,
                                     ConfigurationCacheReferenceType cacheReferenceType,
                                     SchedulingService schedulingService,
                                     long scheduleSlot,
                                     EPStatementAgentInstanceHandle epStatementAgentInstanceHandle)
        {
            MaxAgeMSec         = (long)maxAgeSec * 1000;
            PurgeIntervalMSec  = (long)purgeIntervalSec * 1000;
            _schedulingService = schedulingService;
            _scheduleSlot      = scheduleSlot;

            if (cacheReferenceType == ConfigurationCacheReferenceType.HARD)
            {
                _cache = new Dictionary <Object, Item>();
            }
            else if (cacheReferenceType == ConfigurationCacheReferenceType.SOFT)
            {
                _cache = new ReferenceMap <Object, Item>(ReferenceType.SOFT, ReferenceType.SOFT);
            }
            else
            {
                _cache = new WeakDictionary <Object, Item>();
            }

            _epStatementAgentInstanceHandle = epStatementAgentInstanceHandle;
        }
Esempio n. 3
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="maxAgeSeconds">is the maximum age in seconds</param>
 /// <param name="purgeIntervalSeconds">is the purge interval</param>
 /// <param name="configurationCacheReferenceType">cacheReferenceType the reference type may allow garbage collection to remove entries from
 /// cache unless HARD reference type indicates otherwise</param>
 public ExpiryTimeCacheDesc(double maxAgeSeconds, double purgeIntervalSeconds, ConfigurationCacheReferenceType configurationCacheReferenceType)
 {
     MaxAgeSeconds                   = maxAgeSeconds;
     PurgeIntervalSeconds            = purgeIntervalSeconds;
     ConfigurationCacheReferenceType = configurationCacheReferenceType;
 }
Esempio n. 4
0
 /// <summary>
 /// Configures an expiry-time cache of the given maximum age in seconds and purge interval in seconds. Also allows
 /// setting the reference type indicating whether garbage collection may remove entries from cache.
 /// </summary>
 /// <param name="maxAgeSeconds">the maximum number of seconds before a query result is considered stale (also known as time-to-live)</param>
 /// <param name="purgeIntervalSeconds">the interval at which the engine purges stale data from the cache.</param>
 /// <param name="cacheReferenceType">specifies the reference type to use</param>
 public virtual void SetExpiryTimeCache(double maxAgeSeconds, double purgeIntervalSeconds, ConfigurationCacheReferenceType cacheReferenceType)
 {
     dataCacheDesc = new ConfigurationExpiryTimeCache(maxAgeSeconds, purgeIntervalSeconds, cacheReferenceType);
 }
Esempio n. 5
0
 /// <summary>Ctor. </summary>
 /// <param name="maxAgeSeconds">is the maximum age in seconds</param>
 /// <param name="purgeIntervalSeconds">is the purge interval</param>
 /// <param name="cacheReferenceType">the reference type may allow garbage collection to remove entries fromcache unless HARD reference type indicates otherwise </param>
 public ConfigurationExpiryTimeCache(double maxAgeSeconds, double purgeIntervalSeconds, ConfigurationCacheReferenceType cacheReferenceType)
 {
     this.maxAgeSeconds        = maxAgeSeconds;
     this.purgeIntervalSeconds = purgeIntervalSeconds;
     this.cacheReferenceType   = cacheReferenceType;
 }