diff --git a/EasyCaching.sln b/EasyCaching.sln
index e8f9f0fc..8dc5aa75 100644
--- a/EasyCaching.sln
+++ b/EasyCaching.sln
@@ -49,6 +49,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.CSRedis", "src\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Bus.CSRedis", "src\EasyCaching.Bus.CSRedis\EasyCaching.Bus.CSRedis.csproj", "{861E5373-BEF6-4AA2-92C7-8F4941A079E7}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyCaching.Disk", "src\EasyCaching.Disk\EasyCaching.Disk.csproj", "{3D48FD75-01D6-44F9-B7C3-CB6DE784F476}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -139,6 +141,10 @@ Global
{861E5373-BEF6-4AA2-92C7-8F4941A079E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{861E5373-BEF6-4AA2-92C7-8F4941A079E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{861E5373-BEF6-4AA2-92C7-8F4941A079E7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3D48FD75-01D6-44F9-B7C3-CB6DE784F476}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3D48FD75-01D6-44F9-B7C3-CB6DE784F476}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3D48FD75-01D6-44F9-B7C3-CB6DE784F476}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3D48FD75-01D6-44F9-B7C3-CB6DE784F476}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CE61FAA2-0233-451C-991D-4222ED61C84B} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
@@ -162,5 +168,6 @@ Global
{6EBE36A2-F128-4C63-B90A-B700D8C2F2E8} = {EBB55F65-7D07-4281-8D5E-7B0CA88E1AD0}
{6584761E-E51C-408F-BE51-CA0F6269589B} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
{861E5373-BEF6-4AA2-92C7-8F4941A079E7} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
+ {3D48FD75-01D6-44F9-B7C3-CB6DE784F476} = {A0F5CC7E-155F-4726-8DEB-E966950B3FE9}
EndGlobalSection
EndGlobal
diff --git a/build/releasenotes.props b/build/releasenotes.props
index 2654fab8..40ac6d05 100644
--- a/build/releasenotes.props
+++ b/build/releasenotes.props
@@ -1,34 +1,44 @@
-
- 1. fix typo: IsHightAvailability -> IsHighAvailability.
+
+ 1. Named Serializer
+ 2. Add a new CachingProviderType for DiskCachingProvider
+ 3. Remove Refresh/RefreshAsync methods
+ 4. HybridCachingProvider add GetAsync method with type
1. Upgrading dependencies.
+ 2. Remove Refresh/RefreshAsync methods
- 1. Fixed zrange error.
+ 1. Upgrading dependencies.
+ 2. Remove Refresh/RefreshAsync methods
1. Upgrading dependencies.
+ 2. Remove Refresh/RefreshAsync methods
1. Upgrading dependencies.
+ 2. Remove Refresh/RefreshAsync methods
- 1. Can be downgraded to LocalCacheProvider.
+ 1. Upgrading dependencies.
+ 2. Remove Refresh/RefreshAsync methods
1. Upgrading dependencies.
+ 2. Remove Refresh/RefreshAsync methods
1. Upgrading dependencies.
+ 2. Remove Refresh/RefreshAsync methods
- 1. Upgrading dependencies.
+ 1. Upgrading dependencies.
- 1. Upgrading dependencies.
+ 1. Upgrading dependencies.
1. Upgrading dependencies.
@@ -38,6 +48,7 @@
1. Upgrading dependencies.
+ 2. Remove Refresh/RefreshAsync methods
1. Upgrading dependencies.
@@ -45,5 +56,8 @@
1. Upgrading dependencies.
+
+ 1. init.
+
diff --git a/build/version.props b/build/version.props
index 2fc070ba..c672d79b 100644
--- a/build/version.props
+++ b/build/version.props
@@ -1,20 +1,21 @@
- 0.5.6
- 0.5.6
- 0.5.6.1
- 0.5.6
- 0.5.6
- 0.5.6.1
- 0.5.6
- 0.5.6
- 0.5.6
- 0.5.6
- 0.5.6
- 0.5.6
- 0.5.6
- 0.5.6
- 0.5.6
- 0.5.6
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
+ 0.6.0
diff --git a/src/EasyCaching.Bus.CSRedis/EasyCaching.Bus.CSRedis.csproj b/src/EasyCaching.Bus.CSRedis/EasyCaching.Bus.CSRedis.csproj
index 2f2d10af..90eb66f9 100644
--- a/src/EasyCaching.Bus.CSRedis/EasyCaching.Bus.CSRedis.csproj
+++ b/src/EasyCaching.Bus.CSRedis/EasyCaching.Bus.CSRedis.csproj
@@ -3,15 +3,15 @@
netstandard2.0
- Catcher Wong
- Catcher Wong
+ ncc;Catcher Wong
+ ncc;Catcher Wong
$(EasyCachingRedisBusPackageVersion)
A simple caching bus(message bus) based on CSRedis.
Bus,Hybrid,Redis,Caching,Cache
https://github.com/dotnetcore/EasyCaching
- https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
+ LICENSE
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching
https://raw.githubusercontent.com/dotnetcore/EasyCaching/master/media/nuget-icon.png
@@ -26,7 +26,11 @@
-
+
+
+
+
+
diff --git a/src/EasyCaching.Bus.RabbitMQ/EasyCaching.Bus.RabbitMQ.csproj b/src/EasyCaching.Bus.RabbitMQ/EasyCaching.Bus.RabbitMQ.csproj
index 2df0a2e4..ae7d9ee6 100644
--- a/src/EasyCaching.Bus.RabbitMQ/EasyCaching.Bus.RabbitMQ.csproj
+++ b/src/EasyCaching.Bus.RabbitMQ/EasyCaching.Bus.RabbitMQ.csproj
@@ -3,15 +3,15 @@
netstandard2.0
- Catcher Wong
- Catcher Wong
+ ncc;Catcher Wong
+ ncc;Catcher Wong
$(EasyCachingRabbitBusPackageVersion)
A simple caching bus(message bus) based on RabbitMQ.
Bus,Hybrid,RabbitMQ,Caching,Cache
https://github.com/dotnetcore/EasyCaching
- https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
+ LICENSE
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching
https://raw.githubusercontent.com/dotnetcore/EasyCaching/master/media/nuget-icon.png
@@ -25,13 +25,19 @@
$(NoWarn);1591
+
+
+
+
+
+
diff --git a/src/EasyCaching.Bus.Redis/EasyCaching.Bus.Redis.csproj b/src/EasyCaching.Bus.Redis/EasyCaching.Bus.Redis.csproj
index a9e2e243..a509501d 100644
--- a/src/EasyCaching.Bus.Redis/EasyCaching.Bus.Redis.csproj
+++ b/src/EasyCaching.Bus.Redis/EasyCaching.Bus.Redis.csproj
@@ -3,15 +3,15 @@
netstandard2.0
- Catcher Wong
- Catcher Wong
+ ncc;Catcher Wong
+ ncc;Catcher Wong
$(EasyCachingRedisBusPackageVersion)
A simple caching bus(message bus) based on StackExchange.Redis.
Bus,Hybrid,Redis,Caching,Cache
https://github.com/dotnetcore/EasyCaching
- https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
+ LICENSE
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching
https://raw.githubusercontent.com/dotnetcore/EasyCaching/master/media/nuget-icon.png
@@ -25,6 +25,9 @@
$(NoWarn);1591
+
+
+
diff --git a/src/EasyCaching.CSRedis/Configurations/EasyCachingOptionsExtensions.cs b/src/EasyCaching.CSRedis/Configurations/EasyCachingOptionsExtensions.cs
index ffb1df70..5702a410 100644
--- a/src/EasyCaching.CSRedis/Configurations/EasyCachingOptionsExtensions.cs
+++ b/src/EasyCaching.CSRedis/Configurations/EasyCachingOptionsExtensions.cs
@@ -41,10 +41,8 @@ public static EasyCachingOptions UseCSRedis(this EasyCachingOptions options, ICo
void configure(RedisOptions x)
{
- x.CachingProviderType = redisOptions.CachingProviderType;
x.EnableLogging = redisOptions.EnableLogging;
x.MaxRdSecond = redisOptions.MaxRdSecond;
- x.Order = redisOptions.Order;
x.DBConfig = redisOptions.DBConfig;
}
diff --git a/src/EasyCaching.CSRedis/Configurations/RedisOptions.cs b/src/EasyCaching.CSRedis/Configurations/RedisOptions.cs
index 2e3f01d9..43e0244d 100755
--- a/src/EasyCaching.CSRedis/Configurations/RedisOptions.cs
+++ b/src/EasyCaching.CSRedis/Configurations/RedisOptions.cs
@@ -7,7 +7,7 @@ public class RedisOptions : BaseProviderOptions
{
public RedisOptions()
{
- this.CachingProviderType = CachingProviderType.Redis;
+
}
///
diff --git a/src/EasyCaching.CSRedis/Configurations/RedisOptionsExtension.cs b/src/EasyCaching.CSRedis/Configurations/RedisOptionsExtension.cs
index fb6c5384..7fa38803 100755
--- a/src/EasyCaching.CSRedis/Configurations/RedisOptionsExtension.cs
+++ b/src/EasyCaching.CSRedis/Configurations/RedisOptionsExtension.cs
@@ -75,11 +75,11 @@ public void AddServices(IServiceCollection services)
Func createFactory = x =>
{
var clients = x.GetServices();
- var serializer = x.GetRequiredService();
+ var serializers = x.GetServices();
var optionsMon = x.GetRequiredService>();
var options = optionsMon.Get(_name);
var factory = x.GetService();
- return new DefaultCSRedisCachingProvider(_name, clients, serializer, options, factory);
+ return new DefaultCSRedisCachingProvider(_name, clients, serializers, options, factory);
};
services.AddSingleton(createFactory);
diff --git a/src/EasyCaching.CSRedis/DefaultCSRedisCachingProvider.cs b/src/EasyCaching.CSRedis/DefaultCSRedisCachingProvider.cs
index a81f2374..abdc570d 100755
--- a/src/EasyCaching.CSRedis/DefaultCSRedisCachingProvider.cs
+++ b/src/EasyCaching.CSRedis/DefaultCSRedisCachingProvider.cs
@@ -48,31 +48,30 @@ public partial class DefaultCSRedisCachingProvider : EasyCachingAbstractProvider
///
/// Name.
/// Clients.
- /// Serializer.
+ /// Serializers.
/// Options.
/// Logger factory.
public DefaultCSRedisCachingProvider(
string name,
IEnumerable clients,
- IEasyCachingSerializer serializer,
+ IEnumerable serializers,
RedisOptions options,
ILoggerFactory loggerFactory = null)
{
this._name = name;
- this._serializer = serializer;
+ this._serializer = serializers.FirstOrDefault(x => x.Name.Equals(_name)) ?? serializers.Single(x => x.Name.Equals(EasyCachingConstValue.DefaultSerializerName));
this._options = options;
this._logger = loggerFactory?.CreateLogger();
this._cache = clients.Single(x => x.Name.Equals(_name));
this._cacheStats = new CacheStats();
this.ProviderName = this._name;
+ this.ProviderType = CachingProviderType.Redis;
this.ProviderStats = this._cacheStats;
- this.ProviderType = _options.CachingProviderType;
- this.ProviderOrder = _options.Order;
this.ProviderMaxRdSecond = _options.MaxRdSecond;
this.IsDistributedProvider = true;
}
-
+
///
/// Exists the specified cacheKey.
///
@@ -498,42 +497,7 @@ public override int BaseGetCount(string prefix = "")
return this.SearchRedisKeys(this.HandlePrefix(prefix)).Length;
}
-
- ///
- /// Refresh the specified cacheKey, cacheValue and expiration.
- ///
- /// Cache key.
- /// Cache value.
- /// Expiration.
- /// The 1st type parameter.
- public override void BaseRefresh(string cacheKey, T cacheValue, TimeSpan expiration)
- {
- ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));
- ArgumentCheck.NotNull(cacheValue, nameof(cacheValue));
- ArgumentCheck.NotNegativeOrZero(expiration, nameof(expiration));
-
- this.Remove(cacheKey);
- this.Set(cacheKey, cacheValue, expiration);
- }
-
- ///
- /// Refreshs the async.
- ///
- /// The async.
- /// Cache key.
- /// Cache value.
- /// Expiration.
- /// The 1st type parameter.
- public override async Task BaseRefreshAsync(string cacheKey, T cacheValue, TimeSpan expiration)
- {
- ArgumentCheck.NotNullOrWhiteSpace(cacheKey, nameof(cacheKey));
- ArgumentCheck.NotNull(cacheValue, nameof(cacheValue));
- ArgumentCheck.NotNegativeOrZero(expiration, nameof(expiration));
-
- await this.RemoveAsync(cacheKey);
- await this.SetAsync(cacheKey, cacheValue, expiration);
- }
-
+
///
/// Remove the specified cacheKey.
///
diff --git a/src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj b/src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj
index 8630aa45..8bdcdd85 100644
--- a/src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj
+++ b/src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj
@@ -3,15 +3,15 @@
netstandard2.0
- Catcher Wong
- Catcher Wong
+ ncc;Catcher Wong
+ ncc;Catcher Wong
$(EasyCachingCSRedisPackageVersion)
A simple distributed caching provider based on csredis.
Redis,DistributedCache,Caching,Cache
https://github.com/dotnetcore/EasyCaching
- https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
+ LICENSE
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching
https://raw.githubusercontent.com/dotnetcore/EasyCaching/master/media/nuget-icon.png
@@ -26,7 +26,11 @@
-
+
+
+
+
+
diff --git a/src/EasyCaching.Core/Configurations/BaseProviderOptions.cs b/src/EasyCaching.Core/Configurations/BaseProviderOptions.cs
index 28032a3e..8cb0f2f4 100644
--- a/src/EasyCaching.Core/Configurations/BaseProviderOptions.cs
+++ b/src/EasyCaching.Core/Configurations/BaseProviderOptions.cs
@@ -4,16 +4,7 @@
/// Base provider options.
///
public class BaseProviderOptions
- {
- ///
- /// Gets or sets the type of the caching provider.
- ///
- ///
- /// Reserved, not used yet.
- ///
- /// The type of the caching provider.
- public CachingProviderType CachingProviderType { get; set; }
-
+ {
///
/// Gets or sets the max random second.
///
@@ -24,15 +15,6 @@ public class BaseProviderOptions
/// The max random second.
public int MaxRdSecond { get; set; } = 120;
- ///
- /// Gets or sets the order.
- ///
- ///
- /// Mainly for hybird
- ///
- /// The order.
- public int Order { get; set; }
-
///
/// Gets or sets a value indicating whether enable logging.
///
diff --git a/src/EasyCaching.Core/EasyCaching.Core.csproj b/src/EasyCaching.Core/EasyCaching.Core.csproj
index 3f3e1ed3..0079157e 100644
--- a/src/EasyCaching.Core/EasyCaching.Core.csproj
+++ b/src/EasyCaching.Core/EasyCaching.Core.csproj
@@ -3,15 +3,15 @@
netstandard2.0
- Catcher Wong
- Catcher Wong
+ ncc;Catcher Wong
+ ncc;Catcher Wong
$(EasyCachingCorePackageVersion)
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!
Caching,Cache,Distributed,Memory,Interceptor,Hybrid,ResponseCaching
https://github.com/dotnetcore/EasyCaching
- https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE
+ LICENSE
https://github.com/dotnetcore/EasyCaching
https://github.com/dotnetcore/EasyCaching
https://raw.githubusercontent.com/dotnetcore/EasyCaching/master/media/nuget-icon.png
@@ -25,6 +25,10 @@
$(NoWarn);1591
+
+
+
+
diff --git a/src/EasyCaching.Core/EasyCachingAbstractProvider.cs b/src/EasyCaching.Core/EasyCachingAbstractProvider.cs
index 4de506d5..3fdb3f67 100644
--- a/src/EasyCaching.Core/EasyCachingAbstractProvider.cs
+++ b/src/EasyCaching.Core/EasyCachingAbstractProvider.cs
@@ -14,14 +14,12 @@ public abstract class EasyCachingAbstractProvider : IEasyCachingProvider
protected string ProviderName { get; set; }
protected bool IsDistributedProvider { get; set; }
- protected int ProviderOrder { get; set; }
protected int ProviderMaxRdSecond { get; set; }
protected CachingProviderType ProviderType { get; set; }
protected CacheStats ProviderStats { get; set; }
public string Name => this.ProviderName;
public bool IsDistributedCache => this.IsDistributedProvider;
- public int Order => this.ProviderOrder;
public int MaxRdSecond => this.ProviderMaxRdSecond;
public CachingProviderType CachingProviderType => this.ProviderType;
public CacheStats CacheStats => this.ProviderStats;
@@ -40,8 +38,6 @@ public abstract class EasyCachingAbstractProvider : IEasyCachingProvider
public abstract IDictionary> BaseGetByPrefix(string prefix);
public abstract Task>> BaseGetByPrefixAsync(string prefix);
public abstract int BaseGetCount(string prefix = "");
- public abstract void BaseRefresh(string cacheKey, T cacheValue, TimeSpan expiration);
- public abstract Task BaseRefreshAsync(string cacheKey, T cacheValue, TimeSpan expiration);
public abstract void BaseRemove(string cacheKey);
public abstract void BaseRemoveAll(IEnumerable cacheKeys);
public abstract Task BaseRemoveAllAsync(IEnumerable cacheKeys);
@@ -402,58 +398,6 @@ public int GetCount(string prefix = "")
return BaseGetCount(prefix);
}
- public void Refresh(string cacheKey, T cacheValue, TimeSpan expiration)
- {
- var operationId = s_diagnosticListener.WriteSetCacheBefore(new BeforeSetRequestEventData(CachingProviderType.ToString(), Name, nameof(Refresh), new Dictionary { { cacheKey, cacheValue } }, expiration));
- Exception e = null;
- try
- {
- BaseRefresh(cacheKey, cacheValue, expiration);
- }
- catch (Exception ex)
- {
- e = ex;
- throw;
- }
- finally
- {
- if (e != null)
- {
- s_diagnosticListener.WriteSetCacheError(operationId, e);
- }
- else
- {
- s_diagnosticListener.WriteSetCacheAfter(operationId);
- }
- }
- }
-
- public async Task RefreshAsync(string cacheKey, T cacheValue, TimeSpan expiration)
- {
- var operationId = s_diagnosticListener.WriteSetCacheBefore(new BeforeSetRequestEventData(CachingProviderType.ToString(), Name, nameof(RefreshAsync), new Dictionary { { cacheKey, cacheValue } }, expiration));
- Exception e = null;
- try
- {
- await BaseRefreshAsync(cacheKey, cacheValue, expiration);
- }
- catch (Exception ex)
- {
- e = ex;
- throw;
- }
- finally
- {
- if (e != null)
- {
- s_diagnosticListener.WriteSetCacheError(operationId, e);
- }
- else
- {
- s_diagnosticListener.WriteSetCacheAfter(operationId);
- }
- }
- }
-
public void Remove(string cacheKey)
{
var operationId = s_diagnosticListener.WriteRemoveCacheBefore(new BeforeRemoveRequestEventData(CachingProviderType.ToString(), Name, nameof(Remove), new[] { cacheKey }));
diff --git a/src/EasyCaching.Core/IEasyCachingProvider.cs b/src/EasyCaching.Core/IEasyCachingProvider.cs
index 811a5702..b5e4b396 100644
--- a/src/EasyCaching.Core/IEasyCachingProvider.cs
+++ b/src/EasyCaching.Core/IEasyCachingProvider.cs
@@ -112,24 +112,6 @@ public interface IEasyCachingProvider
/// true if is distributed cache; otherwise, false.
bool IsDistributedCache { get; }
- ///
- /// Refresh the cached value by specified cacheKey, cacheValue and expiration.
- ///
- /// Cache key.
- /// Cache value.
- /// Expiration.
- /// The 1st type parameter.
- void Refresh(string cacheKey, T cacheValue, TimeSpan expiration);
-
- ///
- /// Refresh the cached value by specified cacheKey, cacheValue and expiration async.
- ///
- /// Cache key.
- /// Cache value.
- /// Expiration.
- /// The 1st type parameter.
- Task RefreshAsync(string cacheKey, T cacheValue, TimeSpan expiration);
-
///
/// Removes cached item by cachekey's prefix.
///
@@ -222,12 +204,6 @@ public interface IEasyCachingProvider
/// The async.
Task FlushAsync();
- ///
- /// Gets the order.
- ///
- /// The order.
- int Order { get; }
-
///
/// Gets the max rd second.
///
diff --git a/src/EasyCaching.Core/IHybridCachingProvider.cs b/src/EasyCaching.Core/IHybridCachingProvider.cs
index a82e4abd..959dc5ed 100644
--- a/src/EasyCaching.Core/IHybridCachingProvider.cs
+++ b/src/EasyCaching.Core/IHybridCachingProvider.cs
@@ -152,5 +152,13 @@ public interface IHybridCachingProvider
///
/// Prefix of CacheKey.
Task RemoveByPrefixAsync(string prefix);
+
+ ///
+ /// Gets the specified cacheKey async.
+ ///
+ /// The async.
+ /// Cache key.
+ /// Object Type.
+ Task
diff --git a/test/EasyCaching.UnitTests/SerializerTests/JsonSerializerTest.cs b/test/EasyCaching.UnitTests/SerializerTests/JsonSerializerTest.cs
index a381f4d1..56eb1a4a 100644
--- a/test/EasyCaching.UnitTests/SerializerTests/JsonSerializerTest.cs
+++ b/test/EasyCaching.UnitTests/SerializerTests/JsonSerializerTest.cs
@@ -10,11 +10,7 @@ public class JsonSerializerTest : BaseSerializerTest
{
public JsonSerializerTest()
{
- var options = A.Fake>();
-
- A.CallTo(() => options.Value).Returns(new EasyCachingJsonSerializerOptions());
-
- _serializer = new DefaultJsonSerializer(options);
+ _serializer = new DefaultJsonSerializer("json", new EasyCachingJsonSerializerOptions());
}
[Fact]
@@ -31,15 +27,11 @@ public void Isuue_50_Test()
[Fact]
public void ReferenceLoopHandling_Test_Should_Succeed()
{
- var options = A.Fake>();
-
- A.CallTo(() => options.Value).Returns(new EasyCachingJsonSerializerOptions()
+ var serializer = new DefaultJsonSerializer("json", new EasyCachingJsonSerializerOptions()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
});
- var serializer = new DefaultJsonSerializer(options);
-
Employee joe = new Employee { Name = "Joe User" };
Employee mike = new Employee { Name = "Mike Manager" };
joe.Manager = mike;
@@ -62,15 +54,11 @@ public class Employee
[Fact]
public void NullValueHandling_Test_Should_Succeed()
{
- var options = A.Fake>();
-
- A.CallTo(() => options.Value).Returns(new EasyCachingJsonSerializerOptions()
+ var serializer = new DefaultJsonSerializer("json", new EasyCachingJsonSerializerOptions()
{
NullValueHandling = NullValueHandling.Ignore
});
- var serializer = new DefaultJsonSerializer(options);
-
Employee joe = new Employee { Name = "Joe User" };
var joe_byte = serializer.Serialize(joe);
diff --git a/test/EasyCaching.UnitTests/SerializerTests/MessagePackSerializerTest.cs b/test/EasyCaching.UnitTests/SerializerTests/MessagePackSerializerTest.cs
index d900cc59..50efb697 100644
--- a/test/EasyCaching.UnitTests/SerializerTests/MessagePackSerializerTest.cs
+++ b/test/EasyCaching.UnitTests/SerializerTests/MessagePackSerializerTest.cs
@@ -6,7 +6,7 @@ public class MessagePackSerializerTest : BaseSerializerTest
{
public MessagePackSerializerTest()
{
- _serializer = new DefaultMessagePackSerializer();
+ _serializer = new DefaultMessagePackSerializer("msgpack");
}
}
}
\ No newline at end of file
diff --git a/test/EasyCaching.UnitTests/SerializerTests/ProtobufSerializerTest.cs b/test/EasyCaching.UnitTests/SerializerTests/ProtobufSerializerTest.cs
index 909b5d6d..0bc538c3 100644
--- a/test/EasyCaching.UnitTests/SerializerTests/ProtobufSerializerTest.cs
+++ b/test/EasyCaching.UnitTests/SerializerTests/ProtobufSerializerTest.cs
@@ -6,7 +6,7 @@ public class ProtobufSerializerTest: BaseSerializerTest
{
public ProtobufSerializerTest()
{
- _serializer = new DefaultProtobufSerializer();
+ _serializer = new DefaultProtobufSerializer("proto");
}
}
}