Ejemplo n.º 1
0
        public void AddOrUpdate([NotNull] ICycleProcessingContextParams @params)
        {
            if (@params == null)
            {
                throw new ArgumentNullException(nameof(@params));
            }

            _context.AddOrUpdate(@params.ParamsTypeId, @params, (guid, o) => @params);
        }
Ejemplo n.º 2
0
        public static bool ContainsEvent(
            [NotNull] this MemoryCache cache,
            [NotNull] ICycleProcessingContextParams contextParams)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }
            if (contextParams == null)
            {
                throw new ArgumentNullException(nameof(contextParams));
            }

            return(cache.Contains(contextParams.UniqObjectId.ToString()));
        }
Ejemplo n.º 3
0
        public static void AddEventToCache(
            [NotNull] this MemoryCache cache,
            [NotNull] ICycleProcessingContextParams contextParams,
            TimeSpan lifeTime)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }
            if (contextParams == null)
            {
                throw new ArgumentNullException(nameof(contextParams));
            }

            cache.Add(new CacheItem(contextParams.UniqObjectId.ToString(), contextParams), new CacheItemPolicy
            {
                AbsoluteExpiration = DateTimeOffset.UtcNow + lifeTime
            });
        }