diff --git a/README.md b/README.md
index 51dd05af..defa09bb 100644
--- a/README.md
+++ b/README.md
@@ -119,75 +119,17 @@ public class ValuesController : Controller
For more helpful information about EasyCaching, please click [here](http://easycaching.readthedocs.io/en/latest/) for EasyCaching's documentation.
+## Extension Libs
+
+- [EasyCaching.Extensions](https://github.com/yrinleung/EasyCaching.Extensions)
+
## Examples
See [sample](https://github.com/catcherwong/EasyCaching/tree/master/sample)
## Todo List
-### Caching Providers
-
-- [x] Memory
-- [x] Redis(Based on [StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis))
-- [x] Redis(Based on [csredis](https://github.com/2881099/csredis))
-- [x] SQLite
-- [x] Memcached
-- [x] Hybrid(Combine local caching and distributed caching)
-- [ ] Disk
-- [ ] Others...
-
-### Basic Caching API
-
-- [x] Get/GetAsync(with data retriever)
-- [x] Get/GetAsync(without data retriever)
-- [x] Set/SetAsync
-- [x] Remove/RemoveAsync
-- [x] Refresh/RefreshAsync
-- [x] RemoveByPrefix/RemoveByPrefixAsync
-- [x] SetAll/SetAllAsync
-- [x] GetAll/GetAllAsync
-- [x] GetByPrefix/GetByPrefixAsync
-- [x] RemoveAll/RemoveAllAsync
-- [x] GetCount
-- [x] Flush/FlushAsync
-- [x] TrySet/TrySetAsync
-- [ ] Others...
-
-### Serializer Extensions
-
-- [x] BinaryFormatter
-- [x] MessagePack
-- [x] Json
-- [x] ProtoBuf
-- [ ] Others...
-
-### Caching Interceptor
-
-- [x] AspectCore
-- [x] Castle
-- [ ] Others ..
-
-1. EasyCachingAble
-2. EasyCachingPut
-3. EasyCachingEvict
-
-> Note: Not support Hybird Caching provider yet.
-
-### Caching Bus
-
-- [x] Redis (Based on [StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis))
-- [x] Redis (Based on [csredis](https://github.com/2881099/csredis))
-- [x] RabbitMQ
-
-### Others
-
-- [x] Configuration
-- [x] Caching Region (one region with an instance of provider)
-- [x] Caching Statistics
-- [ ] UI Manager
-- [x] Logger
-- [ ] Caching Warm Up
-- [ ] ...
+See [ToDo List](ToDoList.md)
## Contributing
diff --git a/ToDoList.md b/ToDoList.md
new file mode 100644
index 00000000..a221e05b
--- /dev/null
+++ b/ToDoList.md
@@ -0,0 +1,65 @@
+# Todo List
+
+## Caching Providers
+
+- [x] Memory
+- [x] Redis(Based on [StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis))
+- [x] Redis(Based on [csredis](https://github.com/2881099/csredis))
+- [x] SQLite
+- [x] Memcached
+- [x] Hybrid(Combine local caching and distributed caching)
+- [ ] Disk
+- [ ] Others...
+
+## Basic Caching API
+
+- [x] Get/GetAsync(with data retriever)
+- [x] Get/GetAsync(without data retriever)
+- [x] Set/SetAsync
+- [x] Remove/RemoveAsync
+- [x] Refresh/RefreshAsync
+- [x] RemoveByPrefix/RemoveByPrefixAsync
+- [x] SetAll/SetAllAsync
+- [x] GetAll/GetAllAsync
+- [x] GetByPrefix/GetByPrefixAsync
+- [x] RemoveAll/RemoveAllAsync
+- [x] GetCount
+- [x] Flush/FlushAsync
+- [x] TrySet/TrySetAsync
+- [ ] Others...
+
+## Serializer Extensions
+
+- [x] BinaryFormatter
+- [x] MessagePack
+- [x] Json
+- [x] ProtoBuf
+- [ ] Others...
+
+## Caching Interceptor
+
+- [x] AspectCore
+- [x] Castle
+- [ ] Others ..
+
+1. EasyCachingAble
+2. EasyCachingPut
+3. EasyCachingEvict
+
+> Note: Not support Hybird Caching provider yet.
+
+## Caching Bus
+
+- [x] Redis (Based on [StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis))
+- [x] Redis (Based on [csredis](https://github.com/2881099/csredis))
+- [x] RabbitMQ
+
+## Others
+
+- [x] Configuration
+- [x] Caching Region (one region with an instance of provider)
+- [x] Caching Statistics
+- [ ] UI Manager
+- [x] Logger
+- [ ] Caching Warm Up
+- [ ] ...
\ No newline at end of file
diff --git a/build/releasenotes.props b/build/releasenotes.props
index fbf3cf0f..f3042411 100644
--- a/build/releasenotes.props
+++ b/build/releasenotes.props
@@ -1,64 +1,50 @@
- 1. Modity diagnostics.
- 2. Add EasyCachingInterceptorOptions
- 3. Add hight availability configuration for Interceptor
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
- 2. Remove AddDefaultMemcached related extension methods
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
- 2. Remove AddDefaultRedisCache related extension methods
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
- 2. Remove AddSQLiteCache extension method
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
- 2. Remove AddDefaultInMemoryCache related extension methods
- 3. Remove key prefix for different instance
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
- 2. Add distributed cache providers and local cache providers configuration.
+ 1. Add GenerateDocumentationFile.
+ 2. Fixed bug of Unable to resolve service for type 'EasyCaching.HybridCache.HybridCachingOptions'
- 1. Update EasyCaching.Core.
- 2. Add hight availability configuration
- 3. Add provider configuration.
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
- 2. Add hight availability configuration
- 3. Add provider Configuration.
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
- 2. Remove AddDefaultJsonSerializer extension method
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
- 2. Remove AddDefaultMessagePackSerializer extension method
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
- 2. Remove AddDefaultProtobufSerializer extension method
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
+ 1. Add GenerateDocumentationFile.
- 1. Update EasyCaching.Core.
+ 1. Add GenerateDocumentationFile.
diff --git a/build/version.props b/build/version.props
index 7a551453..4225a60c 100644
--- a/build/version.props
+++ b/build/version.props
@@ -1,20 +1,20 @@
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
- 0.5.4
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
+ 0.5.4.1
diff --git a/docs/In-Memory.md b/docs/In-Memory.md
index 6cdbf3d2..ae0609ff 100644
--- a/docs/In-Memory.md
+++ b/docs/In-Memory.md
@@ -1,6 +1,6 @@
# DefaultInMemoryCachingProvider
-EasyCaching.InMemory is a in-memory caching lib which is based on **EasyCaching.Core** and **Microsoft.Extensions.Caching.Memory**.
+EasyCaching.InMemory is a in-memory caching lib which is based on **EasyCaching.Core**.
When you use this lib , it means that you will handle the memory of current server . As usual , we named it as local caching .
@@ -30,8 +30,28 @@ public class Startup
//Important step for In-Memory Caching
services.AddEasyCaching(option =>
{
- //use memory cache
+ // use memory cache with a simple way
option.UseInMemory("default");
+
+ // use memory cache with your own configuration
+ config.UseInMemory(options=>
+ {
+ options.DBConfig = new InMemoryCachingOptions
+ {
+ // scan time, default value is 1 min
+ ExpirationScanFrequency = TimeSpan.FromMinutes(1),
+ // total count of cache items, default value is 10000
+ SizeLimit = 100
+ };
+ // the max random second will be added to cache's expiration, default value is 120
+ options.MaxRdSecond = 120;
+ // whether enable logging, default is false
+ options.EnableLogging = false;
+ // mutex key's alive time(ms), default is 5000
+ options.LockMs = 5000;
+ // when mutex key alive, it will sleep some time, default is 300
+ options.SleepMs = 300;
+ }, "default1");
});
}
}
@@ -66,6 +86,9 @@ And what we add in `appsettings.json` are as following:
"CachingProviderType": 1,
"MaxRdSecond": 120,
"Order": 2,
+ "DBConfig":{
+ "SizeLimit": 10000
+ }
}
}
```
@@ -113,4 +136,4 @@ public class ValuesController : Controller
var res = await _provider.GetAsync("demo");
}
}
-```
+```
\ No newline at end of file
diff --git a/src/EasyCaching.Bus.CSRedis/EasyCaching.Bus.CSRedis.csproj b/src/EasyCaching.Bus.CSRedis/EasyCaching.Bus.CSRedis.csproj
index 565c7adc..9c83bba9 100644
--- a/src/EasyCaching.Bus.CSRedis/EasyCaching.Bus.CSRedis.csproj
+++ b/src/EasyCaching.Bus.CSRedis/EasyCaching.Bus.CSRedis.csproj
@@ -9,6 +9,7 @@
A simple caching bus(message bus) based on CSRedis.
+ true
Bus,Hybrid,Redis,Caching,Cache
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.Bus.RabbitMQ/EasyCaching.Bus.RabbitMQ.csproj b/src/EasyCaching.Bus.RabbitMQ/EasyCaching.Bus.RabbitMQ.csproj
index bbf67258..452c2a60 100644
--- a/src/EasyCaching.Bus.RabbitMQ/EasyCaching.Bus.RabbitMQ.csproj
+++ b/src/EasyCaching.Bus.RabbitMQ/EasyCaching.Bus.RabbitMQ.csproj
@@ -9,6 +9,7 @@
A simple caching bus(message bus) based on RabbitMQ.
+ true
Bus,Hybrid,RabbitMQ,Caching,Cache
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.Bus.Redis/EasyCaching.Bus.Redis.csproj b/src/EasyCaching.Bus.Redis/EasyCaching.Bus.Redis.csproj
index 1d1dab6c..e27d8985 100644
--- a/src/EasyCaching.Bus.Redis/EasyCaching.Bus.Redis.csproj
+++ b/src/EasyCaching.Bus.Redis/EasyCaching.Bus.Redis.csproj
@@ -9,6 +9,7 @@
A simple caching bus(message bus) based on StackExchange.Redis.
+ true
Bus,Hybrid,Redis,Caching,Cache
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj b/src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj
index ab111bce..d051c67a 100644
--- a/src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj
+++ b/src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj
@@ -9,6 +9,7 @@
A simple distributed caching provider based on csredis.
+ true
Redis,DistributedCache,Caching,Cache
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.Core/Configurations/BaseProviderOptions.cs b/src/EasyCaching.Core/Configurations/BaseProviderOptions.cs
index 6c60fbe9..28032a3e 100644
--- a/src/EasyCaching.Core/Configurations/BaseProviderOptions.cs
+++ b/src/EasyCaching.Core/Configurations/BaseProviderOptions.cs
@@ -18,7 +18,8 @@ public class BaseProviderOptions
/// Gets or sets the max random second.
///
///
- /// Prevent Cache Crash
+ /// If this value greater then zero, the seted cache items' expiration will add a random second
+ /// This is mainly for preventing Cache Crash
///
/// The max random second.
public int MaxRdSecond { get; set; } = 120;
@@ -40,12 +41,14 @@ public class BaseProviderOptions
///
/// Gets or sets the sleep ms.
+ /// when mutex key alive, it will sleep some time, default is 300
///
/// The sleep ms.
public int SleepMs { get; set; } = 300;
///
/// Gets or sets the lock ms.
+ /// mutex key's alive time(ms), default is 5000
///
/// The lock ms.
public int LockMs { get; set; } = 5000;
diff --git a/src/EasyCaching.Core/EasyCaching.Core.csproj b/src/EasyCaching.Core/EasyCaching.Core.csproj
index 4d436797..8a14090b 100644
--- a/src/EasyCaching.Core/EasyCaching.Core.csproj
+++ b/src/EasyCaching.Core/EasyCaching.Core.csproj
@@ -9,6 +9,7 @@
EasyCaching is a open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
+ true
Caching,Cache,Distributed,Memory,Interceptor,Hybrid,ResponseCaching
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.HybridCache/EasyCaching.HybridCache.csproj b/src/EasyCaching.HybridCache/EasyCaching.HybridCache.csproj
index 547d5ec5..fcd9f41e 100644
--- a/src/EasyCaching.HybridCache/EasyCaching.HybridCache.csproj
+++ b/src/EasyCaching.HybridCache/EasyCaching.HybridCache.csproj
@@ -9,6 +9,7 @@
A simple hybrid caching provider combines local caching and distributed caching.
+ true
Hybrid,Synchronization,LocalCache,DistributedCache,Caching
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.HybridCache/HybridCachingProvider.cs b/src/EasyCaching.HybridCache/HybridCachingProvider.cs
index ca2d79a1..63075f0d 100644
--- a/src/EasyCaching.HybridCache/HybridCachingProvider.cs
+++ b/src/EasyCaching.HybridCache/HybridCachingProvider.cs
@@ -47,7 +47,7 @@ public class HybridCachingProvider : IHybridCachingProvider
/// Bus.
/// Logger factory.
public HybridCachingProvider(
- HybridCachingOptions optionsAccs
+ IOptions optionsAccs
, IEasyCachingProviderFactory factory
, IEasyCachingBus bus = null
, ILoggerFactory loggerFactory = null
@@ -55,7 +55,7 @@ HybridCachingOptions optionsAccs
{
ArgumentCheck.NotNull(factory, nameof(factory));
- this._options = optionsAccs;
+ this._options = optionsAccs.Value;
ArgumentCheck.NotNullOrWhiteSpace(_options.TopicName, nameof(_options.TopicName));
diff --git a/src/EasyCaching.InMemory/EasyCaching.InMemory.csproj b/src/EasyCaching.InMemory/EasyCaching.InMemory.csproj
index 68b81006..b4ef257a 100644
--- a/src/EasyCaching.InMemory/EasyCaching.InMemory.csproj
+++ b/src/EasyCaching.InMemory/EasyCaching.InMemory.csproj
@@ -9,6 +9,7 @@
A simple in-memory caching provider.
+ true
In-Memory,LocalCache,Caching,Cache
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.InMemory/Internal/InMemoryCachingOptions.cs b/src/EasyCaching.InMemory/Internal/InMemoryCachingOptions.cs
index 06ad0d47..c8811b68 100644
--- a/src/EasyCaching.InMemory/Internal/InMemoryCachingOptions.cs
+++ b/src/EasyCaching.InMemory/Internal/InMemoryCachingOptions.cs
@@ -5,8 +5,16 @@
public class InMemoryCachingOptions : IOptions
{
+ ///
+ /// Gets or sets the expiration scan frequency.
+ ///
+ /// The expiration scan frequency.
public TimeSpan ExpirationScanFrequency { get; set; } = TimeSpan.FromMinutes(1);
+ ///
+ /// Gets or sets the size limit.
+ ///
+ /// The size limit.
public int SizeLimit { get; set; } = 10000;
diff --git a/src/EasyCaching.Interceptor.AspectCore/EasyCaching.Interceptor.AspectCore.csproj b/src/EasyCaching.Interceptor.AspectCore/EasyCaching.Interceptor.AspectCore.csproj
index 80221165..fd41c91f 100644
--- a/src/EasyCaching.Interceptor.AspectCore/EasyCaching.Interceptor.AspectCore.csproj
+++ b/src/EasyCaching.Interceptor.AspectCore/EasyCaching.Interceptor.AspectCore.csproj
@@ -9,6 +9,7 @@
A simple caching AOP extension library based on AspectCore
+ true
Interceptor,AspectCore,AOP,Caching,Cache
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.Interceptor.Castle/EasyCaching.Interceptor.Castle.csproj b/src/EasyCaching.Interceptor.Castle/EasyCaching.Interceptor.Castle.csproj
index 8ee87bbb..62eae3d1 100644
--- a/src/EasyCaching.Interceptor.Castle/EasyCaching.Interceptor.Castle.csproj
+++ b/src/EasyCaching.Interceptor.Castle/EasyCaching.Interceptor.Castle.csproj
@@ -9,6 +9,7 @@
A simple caching AOP extension library based on Castle
+ true
Interceptor,Castle,AOP,Caching,Cache
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.Memcached/EasyCaching.Memcached.csproj b/src/EasyCaching.Memcached/EasyCaching.Memcached.csproj
index 7eda0433..237364f4 100644
--- a/src/EasyCaching.Memcached/EasyCaching.Memcached.csproj
+++ b/src/EasyCaching.Memcached/EasyCaching.Memcached.csproj
@@ -9,6 +9,7 @@
A simple distributed caching provider based on EnyimMemcachedCore.
+ true
Memcached,DistributedCache,Caching,Cache
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.Redis/EasyCaching.Redis.csproj b/src/EasyCaching.Redis/EasyCaching.Redis.csproj
index ac4d52b6..da74c44c 100644
--- a/src/EasyCaching.Redis/EasyCaching.Redis.csproj
+++ b/src/EasyCaching.Redis/EasyCaching.Redis.csproj
@@ -9,6 +9,7 @@
A simple distributed caching provider based on StackExchange.Redis.
+ true
Redis,DistributedCache,Caching,Cache
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.ResponseCaching/EasyCaching.ResponseCaching.csproj b/src/EasyCaching.ResponseCaching/EasyCaching.ResponseCaching.csproj
index 2e51070f..a9d52cd9 100644
--- a/src/EasyCaching.ResponseCaching/EasyCaching.ResponseCaching.csproj
+++ b/src/EasyCaching.ResponseCaching/EasyCaching.ResponseCaching.csproj
@@ -9,6 +9,7 @@
EasyCaching.ResponseCaching is the extension of ResponseCaching
+ true
Caching,Cache,ResponseCaching
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.SQLite/EasyCaching.SQLite.csproj b/src/EasyCaching.SQLite/EasyCaching.SQLite.csproj
index 18a87dbf..629ae947 100644
--- a/src/EasyCaching.SQLite/EasyCaching.SQLite.csproj
+++ b/src/EasyCaching.SQLite/EasyCaching.SQLite.csproj
@@ -9,6 +9,7 @@
A simple local caching provider based on Microsoft.Data.SQLite
+ true
SQLite,LocalCache,Caching,Cache,InMemory,Persisted
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.Serialization.Json/EasyCaching.Serialization.Json.csproj b/src/EasyCaching.Serialization.Json/EasyCaching.Serialization.Json.csproj
index dc35e654..51463653 100644
--- a/src/EasyCaching.Serialization.Json/EasyCaching.Serialization.Json.csproj
+++ b/src/EasyCaching.Serialization.Json/EasyCaching.Serialization.Json.csproj
@@ -9,6 +9,7 @@
A serialize library based on Newtonsoft.Json
+ true
Caching,Serialization,Json
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.Serialization.MessagePack/EasyCaching.Serialization.MessagePack.csproj b/src/EasyCaching.Serialization.MessagePack/EasyCaching.Serialization.MessagePack.csproj
index 145c1237..f421dd1c 100644
--- a/src/EasyCaching.Serialization.MessagePack/EasyCaching.Serialization.MessagePack.csproj
+++ b/src/EasyCaching.Serialization.MessagePack/EasyCaching.Serialization.MessagePack.csproj
@@ -9,6 +9,7 @@
A serialize library based on MessagePack
+ true
Caching,Serialization,MessagePack
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/src/EasyCaching.Serialization.Protobuf/EasyCaching.Serialization.Protobuf.csproj b/src/EasyCaching.Serialization.Protobuf/EasyCaching.Serialization.Protobuf.csproj
index 7e66d6b8..6db7cb7f 100644
--- a/src/EasyCaching.Serialization.Protobuf/EasyCaching.Serialization.Protobuf.csproj
+++ b/src/EasyCaching.Serialization.Protobuf/EasyCaching.Serialization.Protobuf.csproj
@@ -9,6 +9,7 @@
A serialize library based on protobuf-net
+ true
Caching,Serialization,Protobuf
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
diff --git a/test/EasyCaching.UnitTests/CachingTests/HybridCachingTest.cs b/test/EasyCaching.UnitTests/CachingTests/HybridCachingTest.cs
index 9f78caaa..8dc8e2a8 100644
--- a/test/EasyCaching.UnitTests/CachingTests/HybridCachingTest.cs
+++ b/test/EasyCaching.UnitTests/CachingTests/HybridCachingTest.cs
@@ -7,14 +7,15 @@
using EasyCaching.InMemory;
using EasyCaching.Redis;
using Microsoft.Extensions.DependencyInjection;
+ using Microsoft.Extensions.Options;
using System;
using System.Threading.Tasks;
using Xunit;
public class HybridCachingTest //: BaseCachingProviderTest
{
- private HybridCachingProvider hybridCaching_1;
- private HybridCachingProvider hybridCaching_2;
+ private IHybridCachingProvider hybridCaching_1;
+ //private HybridCachingProvider hybridCaching_2;
private IEasyCachingProviderFactory factory;
private string _namespace;
@@ -33,11 +34,21 @@ public HybridCachingTest()
config.DBConfig.Database = 5;
}, "myredis");
+ option.UseHybrid(config =>
+ {
+ config.EnableLogging = false;
+ config.TopicName = "test_topic";
+ config.LocalCacheProviderName = "m1";
+ config.DistributedCacheProviderName = "myredis";
+ });
+
option.WithRedisBus(config =>
{
config.Endpoints.Add(new Core.Configurations.ServerEndPoint("127.0.0.1", 6379));
config.Database = 6;
});
+
+
});
IServiceProvider serviceProvider = services.BuildServiceProvider();
@@ -45,21 +56,7 @@ public HybridCachingTest()
var bus = serviceProvider.GetService();
- hybridCaching_1 = new HybridCachingProvider(new HybridCachingOptions
- {
- EnableLogging = false,
- TopicName = "test_topic",
- LocalCacheProviderName = "m1",
- DistributedCacheProviderName = "myredis"
- }, factory, bus);
-
- hybridCaching_2 = new HybridCachingProvider(new HybridCachingOptions
- {
- EnableLogging = false,
- TopicName = "test_topic",
- LocalCacheProviderName = "m2",
- DistributedCacheProviderName = "myredis"
- }, factory, bus);
+ hybridCaching_1 = serviceProvider.GetService();
}
[Fact]
@@ -122,7 +119,7 @@ public void Second_Client_Set_Same_Key_Should_Get_New_Value()
hybridCaching_1.Set(cacheKey, "val", TimeSpan.FromSeconds(30));
- hybridCaching_2.Set(cacheKey, "value", TimeSpan.FromSeconds(30));
+ //hybridCaching_2.Set(cacheKey, "value", TimeSpan.FromSeconds(30));
//System.Threading.Thread.Sleep(5000);