public CacheManager(CombinedAssets ca, CachingOptions opts) { Assets = ca; Options = opts; AppHome = VirtualPathUtility.ToAbsolute("~/"); HashToSource = ca.Caches.ToDictionary(c => c.Hash, c => c); PackageFileToSource = ca.Caches.ToDictionary(c => c.PackageFile, c => c); Resolver = new HomePathResolver(ca.ResolvedHomePath); }
/// <summary> /// Used in Gloabal.asax to setup this CacheManager to handle paths where the RouteOptions.BasePath /// leading directory is used to distinguish the paths /// </summary> /// <param name="routes"></param> /// <param name="opts"></param> public static void RegisterDefault(RouteCollection routes, CachingOptions opts = null) { opts = opts ?? new CachingOptions(); var path = string.Format("{0}/{{hash}}/{{type}}/{{*path}}", opts.BasePath); var mgr = new CacheManager(LoadAssets(opts.CacheFile), opts); routes.Insert(0, new Route(path, new CacheHandler(mgr))); Instance = mgr; }