コード例 #1
0
        /// <summary>
        /// Deletes the item from cache
        /// </summary>
        /// <param name="id">A string representing the id of the item in the cache to be deleted</param>
        /// <param name="cacheItemType">A cache item type</param>
        public override void CacheDeleteItem(string id, CacheItemType cacheItemType)
        {
            if (cacheItemType == CacheItemType.All || cacheItemType == CacheItemType.MarketDescription)
            {
                try
                {
                    foreach (var fetchedVariant in _fetchedVariants)
                    {
                        if (fetchedVariant.Key.StartsWith(id))
                        {
                            _fetchedVariants.TryRemove(id, out _);
                        }
                    }
                }
                catch (Exception e)
                {
                    ExecutionLog.LogWarning($"Error deleting fetchedVariants for {id}", e);
                }

                if (_cache.Contains(id))
                {
                    CacheLog.LogDebug($"Delete variant market: {id}");
                    _cache.Remove(id);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Deletes the item from cache
 /// </summary>
 /// <param name="id">A <see cref="URN" /> representing the id of the item in the cache to be deleted</param>
 /// <param name="cacheItemType">A cache item type</param>
 public override void CacheDeleteItem(URN id, CacheItemType cacheItemType)
 {
     if (id != null)
     {
         if (cacheItemType == CacheItemType.All || cacheItemType == CacheItemType.MarketDescription)
         {
             CacheLog.LogDebug($"Delete variant market: {id}");
             _cache.Remove(id.Id.ToString());
         }
     }
 }
コード例 #3
0
 /// <inheritdoc />
 public void AddEventIdForTimelineIgnore(URN eventId, int producerId, Type messageType)
 {
     if (producerId == 4) // BetPal
     {
         if (_ignoreEventsTimelineCache.Contains(eventId.ToString()))
         {
             _ignoreEventsTimelineCache.Get(eventId.ToString()); // to update sliding expiration
         }
         else
         {
             CacheLog.LogDebug($"Received {messageType.Name} - added {eventId} to the ignore timeline list");
             _ignoreEventsTimelineCache.Add(eventId.ToString(),
                                            DateTime.Now,
                                            new CacheItemPolicy {
                 SlidingExpiration = SdkInfo.AddVariableNumber(OperationManager.IgnoreBetPalTimelineSportEventStatusCacheTimeout, 20)
             });
         }
     }
 }