Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public static ICacheStorage CreateStorage(string name)
 {
     return(CacheStorageFactory.Create(name));
 }