Exemple #1
0
        public virtual ICacheStorage CreateStorage(WebPageContext context)
        {
            var value = context.GetConfigValue <string>("Page", "CacheStorage", string.Empty).ToLower();

            if (!string.IsNullOrEmpty(value))
            {
                return(CacheStorageFactory.Create(value));                              //通过存储器名称获取
            }
            //通过后缀名获取
            ICacheStorage storage = null;

            if (_storages.TryGetValue(context.PathExtension, out storage))
            {
                return(storage);
            }

            return(StorageEmpty.Instance);
        }
Exemple #2
0
 public static IList <ICacheStorage> CreateStorages()
 {
     return(CacheStorageFactory.Creates());
 }
Exemple #3
0
 public static ICacheStorage CreateStorage(string name)
 {
     return(CacheStorageFactory.Create(name));
 }
Exemple #4
0
 /// <summary>
 /// 注册存储器名称
 /// </summary>
 /// <param name="name"></param>
 /// <param name="storage"></param>
 public static void RegisterStorageName(string name, ICacheStorage storage)
 {
     CacheStorageFactory.Register(name, storage);
 }