예제 #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);
        }
예제 #2
0
 public static IList <ICacheStorage> CreateStorages()
 {
     return(CacheStorageFactory.Creates());
 }
예제 #3
0
 public static ICacheStorage CreateStorage(string name)
 {
     return(CacheStorageFactory.Create(name));
 }
예제 #4
0
 /// <summary>
 /// 注册存储器名称
 /// </summary>
 /// <param name="name"></param>
 /// <param name="storage"></param>
 public static void RegisterStorageName(string name, ICacheStorage storage)
 {
     CacheStorageFactory.Register(name, storage);
 }