Skip to content

Commit 0ec384a

Browse files
committed
Update CacheManager.Core dependencies
1 parent ad6aaa5 commit 0ec384a

File tree

5 files changed

+40
-35
lines changed

5 files changed

+40
-35
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ namespace EFSecondLevelCache.Core.AspNetCoreSample
364364
// Add an in-memory cache service provider
365365
services.AddSingleton(typeof(ICacheManager<>), typeof(BaseCacheManager<>));
366366
services.AddSingleton(typeof(ICacheManagerConfiguration),
367-
new CacheManager.Core.ConfigurationBuilder()
367+
new CacheManager.Core.CacheConfigurationBuilder()
368368
.WithJsonSerializer()
369369
.WithMicrosoftMemoryCacheHandle(instanceName: "MemoryCache1")
370370
.Build());
@@ -388,7 +388,7 @@ var jss = new JsonSerializerSettings
388388

389389
const string redisConfigurationKey = "redis";
390390
services.AddSingleton(typeof(ICacheManagerConfiguration),
391-
new CacheManager.Core.ConfigurationBuilder()
391+
new CacheManager.Core.CacheConfigurationBuilder()
392392
.WithJsonSerializer(serializationSettings: jss, deserializationSettings: jss)
393393
.WithUpdateMode(CacheUpdateMode.Up)
394394
.WithRedisConfiguration(redisConfigurationKey, config =>

src/Tests/EFCoreSecondLevelCacheInterceptor.Tests/Settings/EFServiceProvider.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ private static void addCacheManagerCoreRedis(ServiceCollection services)
481481

482482
const string redisConfigurationKey = "redis";
483483

484-
services.AddSingleton(typeof(ICacheManagerConfiguration), new CacheManager.Core.ConfigurationBuilder()
484+
services.AddSingleton(typeof(ICacheManagerConfiguration), new CacheConfigurationBuilder()
485485
.WithJsonSerializer(jss, jss)
486486
.WithUpdateMode(CacheUpdateMode.Up)
487487
.WithRedisConfiguration(redisConfigurationKey, config =>
@@ -498,7 +498,6 @@ private static void addCacheManagerCoreRedis(ServiceCollection services)
498498
.WithMaxRetries(retries: 100)
499499
.WithRetryTimeout(timeoutMillis: 50)
500500
.WithRedisCacheHandle(redisConfigurationKey)
501-
.DisablePerformanceCounters()
502501
.DisableStatistics()
503502
.Build());
504503

@@ -508,9 +507,8 @@ private static void addCacheManagerCoreRedis(ServiceCollection services)
508507
private static void addCacheManagerCoreInMemory(ServiceCollection services)
509508
{
510509
services.AddSingleton(typeof(ICacheManagerConfiguration),
511-
new CacheManager.Core.ConfigurationBuilder().WithJsonSerializer()
510+
new CacheConfigurationBuilder().WithJsonSerializer()
512511
.WithMicrosoftMemoryCacheHandle(instanceName: "MemoryCache1")
513-
.DisablePerformanceCounters()
514512
.DisableStatistics()
515513
.Build());
516514

src/Tests/Issues/Issue154/Issue154.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0"/>
2121
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0"/>
2222
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.0"/>
23-
<PackageReference Include="CacheManager.StackExchange.Redis" Version="1.2.0"/>
24-
<PackageReference Include="CacheManager.Core" Version="1.2.0"/>
25-
<PackageReference Include="CacheManager.Microsoft.Extensions.Caching.Memory" Version="1.2.0"/>
26-
<PackageReference Include="CacheManager.Serialization.Json" Version="1.2.0"/>
23+
<PackageReference Include="CacheManager.StackExchange.Redis" Version="2.0.0"/>
24+
<PackageReference Include="CacheManager.Core" Version="2.0.0"/>
25+
<PackageReference Include="CacheManager.Microsoft.Extensions.Caching.Memory" Version="2.0.0"/>
26+
<PackageReference Include="CacheManager.Serialization.Json" Version="2.0.0"/>
2727
</ItemGroup>
2828

2929
<ItemGroup>

src/Tests/Issues/Issue9SQLiteInt32/EFServiceProvider.cs

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public static class EFServiceProvider
2424
/// </summary>
2525
public static IServiceProvider Instance { get; } = _serviceProviderBuilder.Value;
2626

27-
public static T GetRequiredService<T>()
28-
=> Instance.GetRequiredService<T>();
27+
public static T GetRequiredService<T>() => Instance.GetRequiredService<T>();
2928

3029
public static void RunInContext(Action<ApplicationDbContext> action)
3130
{
@@ -52,13 +51,14 @@ private static IServiceProvider getServiceProvider()
5251
Console.WriteLine($"Using `{basePath}` as the ContentRootPath");
5352

5453
var configuration = new ConfigurationBuilder().SetBasePath(basePath)
55-
.AddJsonFile("appsettings.json", false, true).Build();
54+
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
55+
.Build();
5656

5757
services.AddSingleton(_ => configuration);
5858

5959
services.AddEFSecondLevelCache(options
60-
=> options.UseMemoryCacheProvider(CacheExpirationMode.Absolute, TimeSpan.FromMinutes(5))
61-
.ConfigureLogging(true)
60+
=> options.UseMemoryCacheProvider(CacheExpirationMode.Absolute, TimeSpan.FromMinutes(minutes: 5))
61+
.ConfigureLogging(enable: true)
6262

6363
//options.UseCacheManagerCoreProvider()
6464
);
@@ -81,12 +81,12 @@ public static string GetConnectionString(string basePath, IConfigurationRoot con
8181
"\\Issues\\"
8282
}, StringSplitOptions.RemoveEmptyEntries)[0];
8383

84-
var contentRootPath = Path.Combine(testsFolder, "Issues", "Issue9SQLiteInt32");
85-
var connectionString = configuration["ConnectionStrings:ApplicationDbContextConnection"];
84+
var contentRootPath = Path.Combine(testsFolder, path2: "Issues", path3: "Issue9SQLiteInt32");
85+
var connectionString = configuration[key: "ConnectionStrings:ApplicationDbContextConnection"];
8686

87-
if (connectionString.Contains("%CONTENTROOTPATH%"))
87+
if (connectionString.Contains(value: "%CONTENTROOTPATH%"))
8888
{
89-
connectionString = connectionString.Replace("%CONTENTROOTPATH%", contentRootPath);
89+
connectionString = connectionString.Replace(oldValue: "%CONTENTROOTPATH%", contentRootPath);
9090
}
9191

9292
Console.WriteLine($"Using {connectionString}");
@@ -105,18 +105,25 @@ private static void addCacheManagerCoreRedis(ServiceCollection services)
105105

106106
const string redisConfigurationKey = "redis";
107107

108-
services.AddSingleton(typeof(ICacheManagerConfiguration), new CacheManager.Core.ConfigurationBuilder()
109-
.WithJsonSerializer(jss, jss).WithUpdateMode(CacheUpdateMode.Up).WithRedisConfiguration(
110-
redisConfigurationKey, config =>
111-
{
112-
config.WithAllowAdmin().WithDatabase(0).WithEndpoint("localhost", 6379)
113-
114-
// Enables keyspace notifications to react on eviction/expiration of items.
115-
// Make sure that all servers are configured correctly and 'notify-keyspace-events' is at least set to 'Exe', otherwise CacheManager will not retrieve any events.
116-
// See https://redis.io/topics/notifications#configuration for configuration details.
117-
.EnableKeyspaceEvents();
118-
}).WithMaxRetries(100).WithRetryTimeout(50).WithRedisCacheHandle(redisConfigurationKey)
119-
.DisablePerformanceCounters().DisableStatistics().Build());
108+
services.AddSingleton(typeof(ICacheManagerConfiguration), new CacheConfigurationBuilder()
109+
.WithJsonSerializer(jss, jss)
110+
.WithUpdateMode(CacheUpdateMode.Up)
111+
.WithRedisConfiguration(redisConfigurationKey, config =>
112+
{
113+
config.WithAllowAdmin()
114+
.WithDatabase(databaseIndex: 0)
115+
.WithEndpoint(host: "localhost", port: 6379)
116+
117+
// Enables keyspace notifications to react on eviction/expiration of items.
118+
// Make sure that all servers are configured correctly and 'notify-keyspace-events' is at least set to 'Exe', otherwise CacheManager will not retrieve any events.
119+
// See https://redis.io/topics/notifications#configuration for configuration details.
120+
.EnableKeyspaceEvents();
121+
})
122+
.WithMaxRetries(retries: 100)
123+
.WithRetryTimeout(timeoutMillis: 50)
124+
.WithRedisCacheHandle(redisConfigurationKey)
125+
.DisableStatistics()
126+
.Build());
120127

121128
services.AddSingleton(typeof(ICacheManager<>), typeof(BaseCacheManager<>));
122129
}

src/Tests/Issues/Issue9SQLiteInt32/Issue9SQLiteInt32.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0"/>
2121
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0"/>
2222
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.0"/>
23-
<PackageReference Include="CacheManager.StackExchange.Redis" Version="1.2.0"/>
24-
<PackageReference Include="CacheManager.Core" Version="1.2.0"/>
25-
<PackageReference Include="CacheManager.Microsoft.Extensions.Caching.Memory" Version="1.2.0"/>
26-
<PackageReference Include="CacheManager.Serialization.Json" Version="1.2.0"/>
23+
<PackageReference Include="CacheManager.StackExchange.Redis" Version="2.0.0"/>
24+
<PackageReference Include="CacheManager.Core" Version="2.0.0"/>
25+
<PackageReference Include="CacheManager.Microsoft.Extensions.Caching.Memory" Version="2.0.0"/>
26+
<PackageReference Include="CacheManager.Serialization.Json" Version="2.0.0"/>
2727
</ItemGroup>
2828

2929
<ItemGroup>

0 commit comments

Comments
 (0)