public virtual ICache Get <T>(CacheIdentity cacheId) where T : class
        {
            if (!_cacheConstructors.ContainsKey(typeof(T)))
            {
                throw new ArgumentException(string.Format(ExMsg, typeof(T).FullName));
            }
            if (cacheId == null)
            {
                throw new ArgumentNullException("cacheId");
            }

            ICache cache = _caches.GetOrAdd(cacheId.ToString(),
                                            id => {
                Func <CacheIdentity, ICache> ctor = _cacheConstructors[typeof(T)];
                ICache c = ctor(id);
                if (CacheAdministator != null)
                {
                    return(CacheAdministator.Register(c));
                }
                return(c);
            });

            return(cache);
        }
示例#2
0
 static CacheAdministator()
 {
     DefaultInstance = new CacheAdministator();
 }