소스 검색

[CacheControl] Exclude parameters for time cache

feature/authentication-tests
Robin Thoni 10 년 전
부모
커밋
6548ec3e1e
2개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 1
    3
      CacheControl-test/Controllers/MyCacheOutputAttribute.cs
  2. 3
    1
      CacheControl/Business/Attributes/TimeCacheControlAttribute.cs

+ 1
- 3
CacheControl-test/Controllers/MyCacheOutputAttribute.cs 파일 보기

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 파일 보기

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…
취소
저장