Skip to content

Commit ab9dfee

Browse files
committed
updated docs
1 parent e2f6a7b commit ab9dfee

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,29 @@ So you either should use unique method names inside a single controller, or (if
126126
}
127127

128128

129+
Ignoring caching
130+
--------------------
131+
You can set up caching globally (add the caching filter to `HttpConfiguration`) or on controller level (decorate the controller with the cahcing attribute). This means that caching settings will cascade down to all the actions in your entire application (in the first case) or in the controller (in the second case).
132+
133+
You can still instruct a specific action to opt out from caching by using `[IgnoreCacheOutput]` attribute.
134+
135+
[CacheOutput(ClientTimeSpan = 50, ServerTimeSpan = 50)]
136+
public class IgnoreController : ApiController
137+
{
138+
[Route("cached")]
139+
public string GetCached()
140+
{
141+
return DateTime.Now.ToString();
142+
}
143+
144+
[IgnoreCacheOutput]
145+
[Route("uncached")]
146+
public string GetUnCached()
147+
{
148+
return DateTime.Now.ToString();
149+
}
150+
}
151+
129152
Server side caching
130153
--------------------
131154
By default **CacheOutput** will use *System.Runtime.Caching.MemoryCache* to cache on the server side. However, you are free to swap this with anything else

sample/WebApi.OutputCache.V2.Demo/IgnoreController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
namespace WebApi.OutputCache.V2.Demo
55
{
66
[CacheOutput(ClientTimeSpan = 50, ServerTimeSpan = 50)]
7-
[IgnoreCacheOutput]
87
[RoutePrefix("ignore")]
98
public class IgnoreController : ApiController
109
{
@@ -14,6 +13,7 @@ public string GetCached()
1413
return DateTime.Now.ToString();
1514
}
1615

16+
[IgnoreCacheOutput]
1717
[Route("uncached")]
1818
public string GetUnCached()
1919
{

0 commit comments

Comments
 (0)