コード例 #1
0
ファイル: Bundle.cs プロジェクト: TrevorDArcyEvans/EllieWare
        //
        /// <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);
            }
        }
コード例 #2
0
ファイル: Bundle.cs プロジェクト: TrevorDArcyEvans/EllieWare
        /// <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);
        }