/// <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.Warn($"Error deleting fetchedVariants for {id}", e); } if (_cache.Contains(id)) { CacheLog.Debug($"Delete variant market: {id}"); _cache.Remove(id); } } }
/// <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.Debug($"Received {messageType.Name} - added {eventId} to the ignore timeline list"); _ignoreEventsTimelineCache.Add(eventId.ToString(), DateTime.Now, new CacheItemPolicy { SlidingExpiration = OperationManager.IgnoreBetPalTimelineSportEventStatusCacheTimeout }); } } }