Example #1
0
        static MothAction()
        {
            // default cacheprovider uses aspnet cache
            CacheProvider = new AspNetCacheProvider();

            // register the default executors
            RegisterExecutor(new CssExecutor());
            RegisterExecutor(new ScriptExecutor());
            RegisterExecutor(new OutputSubstitutionExecutor());
        }
Example #2
0
        public static T GetFromCache <T>(this IOutputCacheProvider provider, string key, Func <T> fetchAction, TimeSpan duration)
            where T : class
        {
            var obj = provider.Get <T>(key);

            // gotta change this, we'll have to add some <nil> value or something, as this is going to break one day
            if (obj == null)
            {
                obj = fetchAction();
                provider.Store(key, obj, duration);
            }

            return(obj);
        }
Example #3
0
 static ScriptExecutor()
 {
     HashingInstance = new MurmurHash2UInt32Hack();
     Provider        = MothAction.CacheProvider;
 }
Example #4
0
 /// <summary>
 /// Initialize the MothAction (do this in global.asax) with a custom Provider
 /// </summary>
 /// <param name="provider"></param>
 public static void Initialize(IOutputCacheProvider provider)
 {
     CacheProvider = provider;
 }
Example #5
0
 static DataUriHelper()
 {
     Provider = MothAction.CacheProvider;
     Random   = new Random();
 }
Example #6
0
 public ResourcesController()
 {
     _provider = MothAction.CacheProvider;
 }
Example #7
0
 static OutputSubstitutionHelper()
 {
     Provider = MothAction.CacheProvider;
 }
Example #8
0
 static ScriptExecutor()
 {
     HashingInstance = new MurmurHash2UInt32Hack();
     Provider = MothAction.CacheProvider;
 }
Example #9
0
 static MothInlineScriptWrapper()
 {
     Provider = MothAction.CacheProvider;
 }
Example #10
0
 static MothSupportExtensions()
 {
     Provider = MothAction.CacheProvider;
 }
Example #11
0
 /// <summary>
 /// Initialize the MothAction (do this in global.asax) with a custom Provider
 /// </summary>
 /// <param name="provider"></param>
 public static void Initialize(IOutputCacheProvider provider)
 {
     CacheProvider = provider;
 }
Example #12
0
 static MothSupportExtensions()
 {
     Provider = MothAction.CacheProvider;
 }
Example #13
0
 public CssTidy()
 {
     _provider = MothAction.CacheProvider;
     _filename = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "csstidy.exe");
 }
 public ResourcesController()
 {
     _provider = MothAction.CacheProvider;
 }
Example #15
0
 public CssTidy()
 {
     _provider = MothAction.CacheProvider;
     _filename = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "csstidy.exe");
 }