-
Notifications
You must be signed in to change notification settings - Fork 249
Expand file tree
/
Copy pathCacheKeyController.cs
More file actions
41 lines (36 loc) · 1.38 KB
/
CacheKeyController.cs
File metadata and controls
41 lines (36 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Web.Http;
using System.Web.Http.Controllers;
namespace WebApi.OutputCache.V2.Tests.TestControllers
{
public class CacheKeyController : ApiController
{
private class UnregisteredCacheKeyGenerator : ICacheKeyGenerator
{
public string MakeCacheKey(HttpActionContext context, MediaTypeHeaderValue mediaType, bool excludeQueryString, Dictionary<string, List<string>> headers)
{
return "unregistered";
}
public string MakeCacheKey(HttpActionContext context, MediaTypeHeaderValue mediaType, bool excludeQueryString = false)
{
return "unregistered";
}
}
[CacheOutput(CacheKeyGenerator = typeof(CacheKeyGeneratorTests.CustomCacheKeyGenerator), ClientTimeSpan = 100, ServerTimeSpan = 100)]
public string Get_custom_key()
{
return "test";
}
[CacheOutput(CacheKeyGenerator = typeof(UnregisteredCacheKeyGenerator))]
public string Get_unregistered()
{
return "test";
}
[CacheOutput(CacheKeyGenerator = typeof(CacheKeyGeneratorRegistrationTests.InternalRegisteredCacheKeyGenerator), ServerTimeSpan = 100)]
public string Get_internalregistered()
{
return "test";
}
}
}