Beispiel #1
0
        //public bool TryGetValue(object key, out object value)
        //{
        //    return _cache.TryGetValue(key, out value);
        //}

        public void Persist <T>(ICacheEntry entry)
        {
            if (entry.HasExpiration())
            {
                var options = new FileCacheEntryOptions
                {
                    AbsoluteExpiration = entry.AbsoluteExpiration,
                    SlidingExpiration  = entry.SlidingExpiration,
                    AbsoluteExpirationRelativeToNow = entry.AbsoluteExpirationRelativeToNow,
                    Size     = entry.Size,
                    Priority = entry.Priority
                };

                _fileStore.Attach(entry.Key, "FsCacheEntryOptions", options, cacheCluster);
            }

            _fileStore.StoreByKey(entry.Key, (T)entry.Value, cacheCluster);
        }