private object ConfigureEntry(ICacheSetContext context) { var value = (string)context.State; context.SetAbsoluteExpiration(TimeSpan.FromSeconds(7)); context.SetSlidingExpiration(TimeSpan.FromSeconds(3)); context.RegisterPostEvictionCallback(AfterEvicted, null); return value; }
private object ConfigureEntry(ICacheSetContext context) { var value = (string)context.State; context.SetAbsoluteExpiration(TimeSpan.FromSeconds(7)); context.SetSlidingExpiration(TimeSpan.FromSeconds(3)); context.RegisterPostEvictionCallback(AfterEvicted, null); return(value); }
/// <summary> /// Adds inherited trigger and absolute expiration information. /// </summary> /// <param name="link"></param> public static void AddEntryLink(this ICacheSetContext context, IEntryLink link) { foreach (var trigger in link.Triggers) { context.AddExpirationTrigger(trigger); } if (link.AbsoluteExpiration.HasValue) { context.SetAbsoluteExpiration(link.AbsoluteExpiration.Value); } }
// Internal for unit testing internal void UpdateCacheContext(ICacheSetContext cacheSetContext, EntryLink entryLink) { if (ExpiresOn != null) { cacheSetContext.SetAbsoluteExpiration(ExpiresOn.Value); } if (ExpiresAfter != null) { cacheSetContext.SetAbsoluteExpiration(ExpiresAfter.Value); } if (ExpiresSliding != null) { cacheSetContext.SetSlidingExpiration(ExpiresSliding.Value); } if (Priority != null) { cacheSetContext.SetPriority(Priority.Value); } cacheSetContext.AddEntryLink(entryLink); }
public void SetAbsoluteExpiration(TimeSpan relative) { _context.SetAbsoluteExpiration(relative); }
// Internal for unit testing internal void UpdateCacheContext(ICacheSetContext cacheSetContext, EntryLink entryLink) { if (ExpiresOn != null) { cacheSetContext.SetAbsoluteExpiration(ExpiresOn.Value); } if (ExpiresAfter != null) { cacheSetContext.SetAbsoluteExpiration(ExpiresAfter.Value); } if (ExpiresSliding != null) { cacheSetContext.SetSlidingExpiration(ExpiresSliding.Value); } if (Priority != null) { cacheSetContext.SetPriority(Priority.Value); } cacheSetContext.AddEntryLink(entryLink); }