Beispiel #1
0
 /// <summary>
 /// Adds an entry to this cache.
 /// If the cache is full, the LRU (least recently used) entry is dropped.
 /// </summary>
 /// <param name="keys">The keys.</param>
 /// <param name="value">a value to be associated with the specified key.</param>
 public void PutCached(object[] keys, EventTable[] value)
 {
     lock (this)
     {
         var key = DataCacheUtil.GetLookupKey(keys);
         _cache[key] = value;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Adds an entry to this _cache.
 /// If the _cache is full, the LRU (least recently used) entry is dropped.
 /// </summary>
 /// <param name="methodParams">the keys with which the specified value is to be associated.</param>
 /// <param name="numLookupKeys">number of method param keys, from the start, that are for cache lookup</param>
 /// <param name="rows">a value to be associated with the specified key.</param>
 public void PutCached(Object[] methodParams, int numLookupKeys, EventTable[] rows)
 {
     lock (_iLock)
     {
         var key = DataCacheUtil.GetLookupKey(methodParams, numLookupKeys);
         _cache.Put(key, rows);
     }
 }
        public void PutCached(object[] lookupKeys, EventTable[] rows)
        {
            var key  = DataCacheUtil.GetLookupKey(lookupKeys);
            var now  = _schedulingService.Time;
            var item = new Item(rows, now);

            _cache.Put(key, item);

            if (!_isScheduled)
            {
                var callback = new EPStatementHandleCallback(_epStatementAgentInstanceHandle, this);
                _schedulingService.Add(PurgeIntervalMSec, callback, _scheduleSlot);
                _isScheduled = true;
            }
        }
Beispiel #4
0
        public void PutCached(Object[] methodParams, int numLookupKeys, EventTable[] rows)
        {
            var key  = DataCacheUtil.GetLookupKey(methodParams, numLookupKeys);
            var now  = _schedulingService.Time;
            var item = new Item(rows, now);

            _cache.Put(key, item);

            if (!_isScheduled)
            {
                var callback = new EPStatementHandleCallback(_epStatementAgentInstanceHandle, this);
                _schedulingService.Add(_timeAbacus.DeltaForSecondsDouble(_purgeIntervalSec), callback, _scheduleSlot);
                _isScheduled = true;
            }
        }
        public EventTable[] GetCached(object[] lookupKeys)
        {
            var key  = DataCacheUtil.GetLookupKey(lookupKeys);
            var item = _cache.Get(key);

            if (item == null)
            {
                return(null);
            }

            var now = _schedulingService.Time;

            if ((now - item.Time) > MaxAgeMSec)
            {
                _cache.Remove(key);
                return(null);
            }

            return(item.Data);
        }
Beispiel #6
0
        public EventTable[] GetCached(Object[] methodParams, int numLookupKeys)
        {
            var key  = DataCacheUtil.GetLookupKey(methodParams, numLookupKeys);
            var item = _cache.Get(key);

            if (item == null)
            {
                return(null);
            }

            var  now        = _schedulingService.Time;
            long maxAgeMSec = _timeAbacus.DeltaForSecondsDouble(_maxAgeSec);

            if ((now - item.Time) > maxAgeMSec)
            {
                _cache.Remove(key);
                return(null);
            }

            return(item.Data);
        }
Beispiel #7
0
        public EventTable[] GetCached(Object[] methodParams, int numLookupKeys)
        {
            var key = DataCacheUtil.GetLookupKey(methodParams, numLookupKeys);

            return(_cache.Get(key));
        }
Beispiel #8
0
        /// <summary> Retrieves an entry from the cache.
        /// The retrieved entry becomes the MRU (most recently used) entry.
        /// </summary>
        /// <param name="lookupKeys">the key whose associated value is to be returned.
        /// </param>
        /// <returns> the value associated to this key, or null if no value with this key exists in the cache.
        /// </returns>
        public EventTable[] GetCached(object[] lookupKeys)
        {
            var key = DataCacheUtil.GetLookupKey(lookupKeys);

            return(_cache.Get(key));
        }
        public void PutCached(object[] lookupKeys, EventTable[] rows)
        {
            var key = DataCacheUtil.GetLookupKey(lookupKeys);

            _cache.Put(key, rows);
        }