@@ -53,8 +53,8 @@ To configure which cache should be used, the particular client has to be registe
53
53
54
54
By default ServiceStack registers an MemoryCacheClient by default when no ` ICacheClient ` is registered so no registration is necessary.
55
55
56
- ``` csharp
57
- // container.Register <ICacheClient>(new MemoryCacheClient());
56
+ ``` csharp
57
+ // services.AddSingleton <ICacheClient>(new MemoryCacheClient());
58
58
```
59
59
60
60
Even if you have an alternative ` ICacheClient ` registered you can still access the in memory cache via the ` LocalCache ` property in your Services
@@ -63,11 +63,11 @@ and ServiceStack MVC Controllers or anywhere else via the `HostContext.AppHost.G
63
63
64
64
### Redis
65
65
66
- ``` csharp
67
- container . Register <IRedisClientsManager >(c =>
66
+ ``` csharp
67
+ services . AddSingleton <IRedisClientsManager >(c =>
68
68
new RedisManagerPool (" localhost:6379" ));
69
69
70
- container . Register (c => c .Resolve <IRedisClientsManager >().GetCacheClient ());
70
+ services . AddSingleton (c => c .GetRequiredService <IRedisClientsManager >().GetCacheClient ());
71
71
```
72
72
73
73
##### NuGet Package: [ ServiceStack.Redis] ( http://www.nuget.org/packages/ServiceStack.Redis )
@@ -113,7 +113,8 @@ var awsDb = new AmazonDynamoDBClient(
113
113
AWS_ACCESS_KEY , AWS_SECRET_KEY , RegionEndpoint .USEast1 );
114
114
115
115
services .AddSingleton <IPocoDynamo >(new PocoDynamo (awsDb ));
116
- services .AddSingleton <ICacheClient >(c => new DynamoDbCacheClient (c .Resolve <IPocoDynamo >()));
116
+ services .AddSingleton <ICacheClient >(c =>
117
+ new DynamoDbCacheClient (c .GetRequiredService <IPocoDynamo >()));
117
118
118
119
var cache = appHost .Resolve <ICacheClient >();
119
120
cache .InitSchema ();
@@ -138,7 +139,7 @@ and redis server backed Cache Client with:
138
139
```csharp
139
140
services .AddSingleton <ICacheClient >(c => new MultiCacheClient (
140
141
new MemoryCacheClient (),
141
- c .Resolve <IRedisClientsManager >().GetCacheClient ()));
142
+ c .GetRequiredService <IRedisClientsManager >().GetCacheClient ()));
142
143
```
143
144
144
145
## Cache a response of a service
0 commit comments