public SagaDataCache(ICacheFactory cacheFactory, ISerializer serializer, Guid sagaId) { Cache = cacheFactory.NewDisposableCache(); Serializer = serializer; SagaId = sagaId; CacheHashKey = nameof(SagaDataCache) + sagaId; }
protected virtual void Set(ICacheWithHashes cache, string cacheKey, object cachedItem, TimeSpan?expiration) { if (expiration.HasValue) { cache.SetCachedItemAsync(cacheKey, cachedItem, expiration.Value).Wait(); } else { cache.SetCachedItemAsync(cacheKey, cachedItem).Wait(); } }