示例#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);
        }
示例#2
0
 public async Task SetAsync(string key, byte[] value, ExtendedDistributedCacheEntryOptions options, CancellationToken token = default)
 {
     await SetAsync(key, value, options as DistributedCacheEntryOptions, token);
 }
示例#3
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);
        }
示例#4
0
 public void Set(string key, byte[] value, ExtendedDistributedCacheEntryOptions options)
 {
     Set(key, value, options as DistributedCacheEntryOptions);
 }