public static void SaveEvictingItem(this IEvictingStore store, IHasId obj, IExpirable evictingCondition) { if (store == null) { return; } store.Commit(new CommitBag().MarkItemSaved(obj), evictingCondition); }
public static void SaveOneTimeItem(this IEvictingStore store, IHasId obj) { if (store == null) { return; } var expiry = EvictionPolicy.BuildTouchLimitExpirable(1); store.Commit(new CommitBag().MarkItemSaved(obj), expiry); }
/// <summary> /// ctor with no default eviction condition factory. any items added will not be evicted without an eviction being set /// </summary> /// <param name="decorated"></param> /// <param name="backgroundIntervalMSecs"></param> public CacheDecoration(IStore decorated, IEvictingStore cachingStore) : base(decorated) { Condition.Requires(cachingStore).IsNotNull(); this.CachingStore = cachingStore; }
/// <summary> /// adds caching to the store, with the cache supplied. Note: this is how we might inject /// a distributed cache. /// </summary> /// <param name="decorated"></param> /// <param name="cachingStore"></param> /// <returns></returns> public static CacheDecoration Caching(this IStore decorated, IEvictingStore cachingStore) { Condition.Requires(decorated).IsNotNull(); return new CacheDecoration(decorated, cachingStore); }
/// <summary> /// adds caching to the store, with the cache supplied. Note: this is how we might inject /// a distributed cache. /// </summary> /// <param name="decorated"></param> /// <param name="cachingStore"></param> /// <returns></returns> public static CacheDecoration Caching(this IStore decorated, IEvictingStore cachingStore) { Condition.Requires(decorated).IsNotNull(); return(new CacheDecoration(decorated, cachingStore)); }