Browse Source

[CacheControl] Exclude parameters for time cache

feature/authentication-tests
Robin Thoni 9 years ago
parent
commit
6548ec3e1e

+ 1
- 3
CacheControl-test/Controllers/MyCacheOutputAttribute.cs View File

6
 {
6
 {
7
     public class MyCacheOutputAttribute : TimeCacheControlAttribute
7
     public class MyCacheOutputAttribute : TimeCacheControlAttribute
8
     {
8
     {
9
-        public MyCacheOutputAttribute(int seconds, bool excludeGet = false, bool excludePost = false) : base(seconds)
9
+        public MyCacheOutputAttribute(int seconds, bool excludeGet = false, bool excludePost = false) : base(seconds, excludeGet, excludePost)
10
         {
10
         {
11
             CacheType = OutputCacheType.DataBase;
11
             CacheType = OutputCacheType.DataBase;
12
-            ExcludePostFromCacheKey = excludePost;
13
-            ExcludeQueryStringFromCacheKey = excludeGet;
14
             OutputCacheData = ConfigurationManager.ConnectionStrings["ConnectionString42"].ConnectionString;
12
             OutputCacheData = ConfigurationManager.ConnectionStrings["ConnectionString42"].ConnectionString;
15
         }
13
         }
16
     }
14
     }

+ 3
- 1
CacheControl/Business/Attributes/TimeCacheControlAttribute.cs View File

17
         /// <summary>
17
         /// <summary>
18
         /// Contruct a cache control based on time
18
         /// Contruct a cache control based on time
19
         /// </summary>
19
         /// </summary>
20
-        public TimeCacheControlAttribute(int seconds)
20
+        public TimeCacheControlAttribute(int seconds, bool excludeGet = false, bool excludePost = false)
21
         {
21
         {
22
             Seconds = seconds;
22
             Seconds = seconds;
23
+            ExcludePostFromCacheKey = excludePost;
24
+            ExcludeQueryStringFromCacheKey = excludeGet;
23
         }
25
         }
24
 
26
 
25
         /// <summary>
27
         /// <summary>

Loading…
Cancel
Save