Exemple #1
0
 protected override ICollection <string> GetCacheNames(ICacheOperationContext <CacheOperation> context)
 {
     return(new List <string>()
     {
         context.GetOperation().Name
     });
 }
Exemple #2
0
            protected ICollection <ICache> GetCaches(ICacheOperationContext <CacheOperation> context, ICacheResolver cacheResolver)
            {
                var result = cacheResolver.CacheResolve(context);

                if (result.IsNullOrEmpty())
                {
                    throw new Exception("No cache could be resolved for '" +
                                        context.GetOperation() + "' using resolver '" + cacheResolver +
                                        "'. At least one cache should be provided per cache operation.");
                }
                return(result);
            }
Exemple #3
0
        public ICollection <ICache> CacheResolve(ICacheOperationContext <CacheOperation> context)
        {
            ICollection <string> cacheNames = GetCacheNames(context);

            if (cacheNames == null)
            {
                return(new List <ICache>());
            }

            var result = new List <ICache>();

            foreach (var cacheName in cacheNames)
            {
                var cache = CacheManager.GetCache(cacheName);
                if (cache == null)
                {
                    throw new Exception("Cannot find cache name '" +
                                        cacheName + "' for " + context.GetOperation());
                }
                result.Add(cache);
            }

            return(result);
        }
Exemple #4
0
 protected abstract ICollection <string> GetCacheNames(ICacheOperationContext <CacheOperation> context);