Переглянути джерело

[CacheControl] Exclude parameters for time cache

feature/authentication-tests
Robin Thoni 9 роки тому
джерело
коміт
6548ec3e1e

+ 1
- 3
CacheControl-test/Controllers/MyCacheOutputAttribute.cs Переглянути файл

@@ -6,11 +6,9 @@ namespace CacheControl_test.Controllers
6 6
 {
7 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 11
             CacheType = OutputCacheType.DataBase;
12
-            ExcludePostFromCacheKey = excludePost;
13
-            ExcludeQueryStringFromCacheKey = excludeGet;
14 12
             OutputCacheData = ConfigurationManager.ConnectionStrings["ConnectionString42"].ConnectionString;
15 13
         }
16 14
     }

+ 3
- 1
CacheControl/Business/Attributes/TimeCacheControlAttribute.cs Переглянути файл

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

Завантаження…
Відмінити
Зберегти