public virtual Task Set(string key, ICachable value, CacheEntryOptions entryOptions = null) { Condition.Requires(key, nameof(key)).IsNotNull(); Condition.Requires(value, nameof(value)).IsNotNull(); if (entryOptions == null) { entryOptions = new CacheEntryOptions(); } var prefixedKey = CreateKey(key); entryOptions.Priority = entryOptions.Priority ?? _defaultPriority; lock (_keysLock) { if (!_keys.Contains(key)) { _keys.Add(key); } } return(_store.Set(prefixedKey, value, entryOptions)); }
public Task Set(string key, ICachable value, CacheEntryOptions entryOptions = null) { return(_cache.Set(key, value, entryOptions)); }
public static Task SetLong(this ICache cache, string key, long value, CacheEntryOptions entryOptions = null) { var cachable = new Cachable <long>(value, sizeof(long)); return(cache.Set(key, cachable, entryOptions)); }
public static Task SetString(this ICache cache, string key, string value, CacheEntryOptions entryOptions = null) { var cachable = new Cachable <string>(value, Encoding.Unicode.GetByteCount(value)); return(cache.Set(key, cachable, entryOptions)); }
public static Task SetInt(this ICache cache, string key, int value, CacheEntryOptions entryOptions = null) { var cachable = new Cachable <int>(value, sizeof(int)); return(cache.Set(key, cachable, entryOptions)); }