Exemplo n.º 1
0
        //
        /// <summary>
        /// Store the response for this bundle instance in the appropriate caches
        /// </summary>
        /// <param name="context"></param>
        /// <param name="response"></param>
        public virtual void UpdateCache(BundleContext context, BundleResponse response)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (response == null)
            {
                throw new ArgumentNullException("response");
            }

            IBundleCache cache = context.BundleCollection.Cache;

            if (cache.IsEnabled(context))
            {
                cache.Put(context, this, response);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the first cache hit from the context.BundleCollection.CacheList by default.
        /// Can override to implement custom caching logic.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public virtual BundleResponse CacheLookup(BundleContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            IBundleCache cache = context.BundleCollection.Cache;

            if (cache.IsEnabled(context))
            {
                BundleResponse response = cache.Get(context, this);
                if (response != null)
                {
                    return(response);
                }
            }
            return(null);
        }