Ejemplo n.º 1
0
        public static void SetString(this IExtendedDistributedCache cache, string key, string value, ExtendedDistributedCacheEntryOptions options)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            if (options is null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            cache.Set(key, Encoding.UTF8.GetBytes(value), options);
        }
Ejemplo n.º 2
0
        public static async Task SetStringAsync(this IExtendedDistributedCache cache, string key, string value, ExtendedDistributedCacheEntryOptions options, CancellationToken token = default)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            if (options is null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            await cache.SetAsync(key, Encoding.UTF8.GetBytes(value), options, token);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates an instance of <see cref="DistributedCache"/> with <see cref="IExtendedDistributedCache"/>
 /// </summary>
 /// <param name="distributedCache"><see cref="IExtendedDistributedCache"/></param>
 /// <param name="cacheStore"><see cref="ICacheStore"/></param>
 public DistributedCache(IExtendedDistributedCache distributedCache, ICacheStore cacheStore)
 {
     _memoryCache      = distributedCache as IExtendedMemoryCache;
     _distributedCache = distributedCache;
     _cacheStore       = cacheStore;
 }
Ejemplo n.º 4
0
 public DistributedCacheService(IExtendedDistributedCache cache, IJsonSerializer jsonSerializer)
 {
     this.cache          = cache;
     this.jsonSerializer = jsonSerializer;
 }