tisdag 22 november 2011
Example on how to set expiration time on Microsoft.Practices.EnterpriseLibrary.Caching cache.
public class CacheRefreshAction : ICacheItemRefreshAction{
{
public void Refresh(string key, object expiredValue, CacheItemRemovedReason removalReason) // Nothing is done in this Class. It must exist to be able to set a Exoiration time on the PageCache.Add method. }
}
.
.
.
source = oFacade.GetUserRoles(ident.Name);
SecurityFacade oFacade = new SecurityFacade();this.PageCache.Add("Roles" + Context.User.Identity.Name, source, CacheItemPriority.Normal,new CacheRefreshAction(), new AbsoluteTime(DateTime.Now.AddMinutes(20)));Example how to set exiration time to 20 minutes:
Prenumerera på:
Inlägg (Atom)