Esempio n. 1
0
 public CacheOperationMetadata(CacheOperation operation, MethodInfo method, Type targeType, IKeyGenerator keyGenerator, ICacheResolver cacheResolver)
 {
     this.Operation     = operation;
     this.Method        = method;
     this.TargeType     = targeType;
     this.KeyGenerator  = keyGenerator;
     this.CacheResolver = cacheResolver;
 }
Esempio n. 2
0
        public AbstractCacheFilter(ICacheResolver cacheResolver)
        {
            if (cacheResolver == null)
            {
                throw new ArgumentNullException(nameof(cacheResolver));
            }

            this.cacheResolver = cacheResolver;
        }
        public DefaultNonceStore(ICacheResolver cacheResolver)
        {
            if (cacheResolver == null)
            {
                throw new ArgumentNullException(nameof(cacheResolver));
            }

            this.cacheResolver = cacheResolver;
        }
        public AbstractCacheFilter(ICacheResolver cacheResolver)
        {
            if (cacheResolver == null)
            {
                throw new ArgumentNullException(nameof(cacheResolver));
            }

            this.cacheResolver = cacheResolver;
        }
        public DefaultNonceStore(ICacheResolver cacheResolver)
        {
            if (cacheResolver == null)
            {
                throw new ArgumentNullException(nameof(cacheResolver));
            }

            this.cacheResolver = cacheResolver;
        }
        public ReadCacheFilter(string baseUrl, ICacheResolver cacheResolver)
            : base(cacheResolver)
        {
            if (string.IsNullOrEmpty(baseUrl))
            {
                throw new ArgumentNullException(nameof(baseUrl));
            }

            this.baseUrl    = baseUrl;
            this.typeLookup = new ResourceTypeLookup();
        }
        public ReadCacheFilter(string baseUrl, ICacheResolver cacheResolver)
            : base(cacheResolver)
        {
            if (string.IsNullOrEmpty(baseUrl))
            {
                throw new ArgumentNullException(nameof(baseUrl));
            }

            this.baseUrl = baseUrl;
            this.typeLookup = new ResourceTypeLookup();
        }
        public WriteCacheFilter(ICacheResolver cacheResolver, IResourceFactory resourceFactory)
            : base(cacheResolver)
        {
            if (resourceFactory == null)
            {
                throw new ArgumentNullException(nameof(resourceFactory));
            }

            this.resourceFactory = resourceFactory;
            this.typeLookup      = new ResourceTypeLookup();
        }
        public WriteCacheFilter(ICacheResolver cacheResolver, IResourceFactory resourceFactory)
            : base(cacheResolver)
        {
            if (resourceFactory == null)
            {
                throw new ArgumentNullException(nameof(resourceFactory));
            }

            this.resourceFactory = resourceFactory;
            this.typeLookup = new ResourceTypeLookup();
        }
        internal DefaultDataStore(IClient client, IRequestExecutor requestExecutor, string baseUrl, IJsonSerializer serializer, ILogger logger, IUserAgentBuilder userAgentBuilder, ICacheProvider cacheProvider, TimeSpan identityMapExpiration)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            if (requestExecutor == null)
            {
                throw new ArgumentNullException(nameof(requestExecutor));
            }

            if (string.IsNullOrEmpty(baseUrl))
            {
                throw new ArgumentNullException(nameof(baseUrl));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (cacheProvider == null)
            {
                throw new ArgumentNullException(nameof(cacheProvider), "Use NullCacheProvider if you wish to turn off caching.");
            }

            this.baseUrl          = baseUrl;
            this.logger           = logger;
            this.requestExecutor  = requestExecutor;
            this.cacheProvider    = cacheProvider;
            this.cacheResolver    = new DefaultCacheResolver(cacheProvider, this.logger);
            this.userAgentBuilder = userAgentBuilder;

            this.client            = client;
            this.serializer        = new JsonSerializationProvider(serializer);
            this.identityMap       = new MemoryCacheIdentityMap <ResourceData>(identityMapExpiration, this.logger);
            this.resourceFactory   = new DefaultResourceFactory(this, this.identityMap);
            this.resourceConverter = new DefaultResourceConverter();

            this.uriQualifier = new UriQualifier(baseUrl);

            this.defaultAsyncFilters = this.BuildDefaultAsyncFilterChain();
            this.defaultSyncFilters  = this.BuildDefaultSyncFilterChain();
        }
Esempio n. 11
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);
            }