-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathRedisCacheWorkerProvider.cs
More file actions
30 lines (26 loc) · 1.02 KB
/
RedisCacheWorkerProvider.cs
File metadata and controls
30 lines (26 loc) · 1.02 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
using NClient.Common.Helpers;
using NClient.Providers.Serialization;
using StackExchange.Redis;
namespace NClient.Providers.Caching.Redis
{
/// <summary>
/// The provider of the cache worker that store HTTP response data to Redis.
/// </summary>
public class RedisCacheWorkerProvider : IResponseCacheProvider
{
private readonly IDatabaseAsync _redisDb;
/// <summary>Initializes the Redis cache worker based serializer provider.</summary>
/// <param name="redisDb">The redis database.</param>
public RedisCacheWorkerProvider(IDatabaseAsync redisDb)
{
Ensure.IsNotNull(redisDb, nameof(redisDb));
_redisDb = redisDb;
}
/// <summary>Creates System.Text.Json <see cref="ISerializer"/> instance.</summary>
/// <param name="toolset">Tools that help implement providers.</param>
public IResponseCacheWorker Create(IToolset toolset)
{
return new RedisCacheWorker(_redisDb, toolset);
}
}
}