/// <summary>
        /// 添加缓存项,该项在指定的时间过期
        /// </summary>
        public void Add(string cacheManagerName, string key, object obj, DateTime absoluteTime)
        {
            Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
                cacheManager = CacheFactory.GetCacheManager(cacheManagerName);

            cacheManager.Add(key, obj, CacheItemPriority.Normal, null, new AbsoluteTime(absoluteTime));
        }
        public void Add(string cacheManagerName, string key, object obj, params SqlDependencyExpiration[] expirations)
        {
            Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
                cacheManager = CacheFactory.GetCacheManager(cacheManagerName);

            cacheManager.Add(key, obj, CacheItemPriority.Normal, null, expirations);
        }
        /// <summary>
        /// Adds the specified cache manager name.
        /// </summary>
        /// <param name="cacheManagerName">Name of the cache manager.</param>
        /// <param name="key">The key.</param>
        /// <param name="obj">The obj.</param>
        public void Add(string cacheManagerName, string key, Object obj)
        {
            Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
                cacheManager = CacheFactory.GetCacheManager(cacheManagerName);

            cacheManager.Add(key, obj);
        }
        //private SqlDependencyExpiration GetSqlDependencyExpiration(string sqlDependencyProcName, Dictionary<string, object> parameters)
        //{
        //    SqlDependencyExpiration expiration = new SqlDependencyExpiration(sqlDependencyProcName, parameters);
        //    //expiration.Expired += delegate
        //    //{
        //    //    MessageBox.Show("Cache has expired!");
        //    //};
        //    return expiration;
        //}

        /// <summary>
        /// Adds the specified cache manager name.
        /// </summary>
        /// <param name="cacheManagerName">Name of the cache manager.</param>
        /// <param name="key">The key.</param>
        /// <param name="obj">The obj.</param>
        /// <param name="file">The file.</param>
        public void Add(string cacheManagerName, string key, Object obj, string file)
        {
            Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
                cacheManager = CacheFactory.GetCacheManager(cacheManagerName);

            cacheManager.Add(key, obj, CacheItemPriority.Normal, null, new FileDependency(file));
        }
        /// <summary>
        /// Adds the specified cache manager name.
        /// </summary>
        /// <param name="cacheManagerName">Name of the cache manager.</param>
        /// <param name="key">The key.</param>
        /// <param name="obj">The obj.</param>
        /// <param name="duration">滑动过期时间,以秒为单位</param>
        public void Add(string cacheManagerName, string key, Object obj, int slidingExpirationSeconds)
        {
            Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
                cacheManager = CacheFactory.GetCacheManager(cacheManagerName);

            cacheManager.Add(
                key, obj, CacheItemPriority.Normal, null, new SlidingTime(TimeSpan.FromSeconds(slidingExpirationSeconds)));
        }
        /// <summary>
        /// Adds the specified cache manager name and never expired.
        /// </summary>
        /// <param name="cacheManagerName">Name of the cache manager.</param>
        /// <param name="key">The key.</param>
        /// <param name="obj">The obj.</param>
        public void AddNeverExpired(string cacheManagerName, string key, Object obj)
        {
            Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
                cacheManager = CacheFactory.GetCacheManager(cacheManagerName);

            cacheManager.Add(
                key, obj, CacheItemPriority.Normal, null, new NeverExpired());
        }
        /// <summary>
        /// Gets the data.
        /// </summary>
        /// <param name="cacheManagerName">Name of the cache manager.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public T GetData <T>(string cacheManagerName, string key)
        {
            Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
                cacheManager = CacheFactory.GetCacheManager(cacheManagerName);
            T   obj          = (T)cacheManager.GetData(key);

            return(obj);
        }
示例#8
0
 public CacheManager()
 {
     //this.m_cacheManager = CacheBlock.CacheFactory.GetCacheManager();
     this.m_cacheManager = CacheBlock.CacheFactory.GetCacheManager("CacheManager");
 }
示例#9
0
 static CategoryCache()
 {
     _impl = CacheFactory.GetCacheManager("default");
 }
示例#10
0
 public CacheManager()
 {
     manager = CacheFactory.GetCacheManager(Constants.CacheInstance.InstanceName);
 }
 /// <summary>
 /// Gets the data.
 /// </summary>
 /// <param name="cacheManagerName">Name of the cache manager.</param>
 /// <param name="key">The key.</param>
 /// <returns></returns>
 public Object GetData(string cacheManagerName, string key)
 {
     Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
         cacheManager = CacheFactory.GetCacheManager(cacheManagerName);
     return(cacheManager.GetData(key));
 }
 /// <summary>
 /// Flushes the specified cache manager name.
 /// </summary>
 /// <param name="cacheManagerName">Name of the cache manager.</param>
 public void Flush(string cacheManagerName)
 {
     Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
         cacheManager = CacheFactory.GetCacheManager(cacheManagerName);
     cacheManager.Flush();
 }
 /// <summary>
 /// Removes the specified cache manager name.
 /// </summary>
 /// <param name="cacheManagerName">Name of the cache manager.</param>
 /// <param name="key">The key.</param>
 public void Remove(string cacheManagerName, string key)
 {
     Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager
         cacheManager = CacheFactory.GetCacheManager(cacheManagerName);
     cacheManager.Remove(key);
 }
 private EntLibCachingManager()
 {
     CacheManagerFactory factory = new CacheManagerFactory(new EntLibCachingConfigurationSource());
     cache = factory.CreateDefault();
 }
示例#15
0
 public ELCacheManager()
 {
     _cacheManager = CacheFactory.GetCacheManager();
 }
示例#16
0
 public DefaultCacheStrategy()
 {
     cacheManager = MC.CacheFactory.GetCacheManager();
 }
示例#17
0
 static CategoryCache()
 {
     _impl = CacheFactory.GetCacheManager("default");
 }