locked
SlidingTime is not reconized by Asp.net RRS feed

  • Question

  • User43093768 posted
    I am using this code but it seems that SlidingTime is not recognized by Asp.net:

    private CacheManager primitivesCache;
           
            private void Page_Load(object sender, System.EventArgs e)
            {
               
                this.primitivesCache  = CacheFactory.GetCacheManager();
       
                string id = "ProductOneId";
                string name = "ProductXYName";
                int price = 50;


                primitivesCache.Add(id,name,2,null,new SlidingTime(TimeSpan.FromMinutes(5)));
               
               

               
            }

    Monday, May 16, 2005 3:47 PM

All replies

  • User43093768 posted
    I ahve to write this long time to use SlidingExpiration:

    primitivesCache.Add(id,name,CacheItemPriority.None,null, new Microsoft.Practices.EnterpriseLibrary.Caching.Expirations.SlidingTime
                    (TimeSpan.FromMinutes(5))); 

    Even though I already added the Caching namespace. Any ideas !

    Monday, May 16, 2005 3:57 PM
  • User-1027516314 posted

    Since you already added the using Microsoft.Practices.EnterpriseLibrary.Caching.Expirations; I don't think you need to use the long namespace. The only difference I can see between your code and theirs is the bold parameter and your is ASP.NET vs Windows:

    primitivesCache.Add(id, name, CacheItemPriority.Normal, new ProductCacheRefreshAction(), new SlidingTime(TimeSpan.FromMinutes(5)));

    When I look into the source code of the class ProductCacheRefreshAction, its primary purpose is to refresh the cache after an item is removed.  However, there is no implementation there at all from their quickStart sample.

     

    Monday, June 20, 2005 11:39 PM