Skip to content

Commit

Permalink
Merge pull request #193 from dotnetcore/dev
Browse files Browse the repository at this point in the history
Fixed some known issue and upgrade dependencies
  • Loading branch information
catcherwong authored Feb 19, 2020
2 parents 82dd4e1 + 63efb51 commit 934c31c
Show file tree
Hide file tree
Showing 31 changed files with 279 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: csharp
solution: EasyCaching.sln
dist: bionic
sudo: required
dotnet: 3.0.100
dotnet: 3.1.100
mono: none

services:
Expand Down
9 changes: 4 additions & 5 deletions build/releasenotes.props
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<Project>
<PropertyGroup>
<EasyCachingCorePackageNotes>
1. Redis provider support some geo methods.
1. Upgrading dependencies.
</EasyCachingCorePackageNotes>
<EasyCachingMemcachedPackageNotes>
1. Upgrading dependencies.
</EasyCachingMemcachedPackageNotes>
<EasyCachingRedisPackageNotes>
1. Support some geo methods.
1. Upgrading dependencies.
</EasyCachingRedisPackageNotes>
<EasyCachingSQLitePackageNotes>
1. Upgrading dependencies.
</EasyCachingSQLitePackageNotes>
<EasyCachingInMemoryPackageNotes>
1. Fix datetime exception.
2. Upgrading dependencies.
1. Upgrading dependencies.
</EasyCachingInMemoryPackageNotes>
<EasyCachingHybridPackageNotes>
1. Upgrading dependencies.
Expand All @@ -38,7 +37,7 @@
1. Upgrading dependencies.
</EasyCachingProtobufPackageNotes>
<EasyCachingCSRedisPackageNotes>
1. Support some geo methods.
1. Upgrading dependencies.
</EasyCachingCSRedisPackageNotes>
<EasyCachingCSRedisBusPackageNotes>
1. Upgrading dependencies.
Expand Down
34 changes: 17 additions & 17 deletions build/version.props
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project>
<PropertyGroup>
<EasyCachingCorePackageVersion>0.8.3</EasyCachingCorePackageVersion>
<EasyCachingMemcachedPackageVersion>0.8.3</EasyCachingMemcachedPackageVersion>
<EasyCachingRedisPackageVersion>0.8.3</EasyCachingRedisPackageVersion>
<EasyCachingSQLitePackageVersion>0.8.3</EasyCachingSQLitePackageVersion>
<EasyCachingInMemoryPackageVersion>0.8.3</EasyCachingInMemoryPackageVersion>
<EasyCachingHybridPackageVersion>0.8.3</EasyCachingHybridPackageVersion>
<EasyCachingAspectCorePackageVersion>0.8.3</EasyCachingAspectCorePackageVersion>
<EasyCachingCastlePackageVersion>0.8.3</EasyCachingCastlePackageVersion>
<EasyCachingResponseCachingPackageVersion>0.8.3</EasyCachingResponseCachingPackageVersion>
<EasyCachingJsonPackageVersion>0.8.3</EasyCachingJsonPackageVersion>
<EasyCachingMessagePackPackageVersion>0.8.3</EasyCachingMessagePackPackageVersion>
<EasyCachingProtobufPackageVersion>0.8.3</EasyCachingProtobufPackageVersion>
<EasyCachingCSRedisPackageVersion>0.8.3</EasyCachingCSRedisPackageVersion>
<EasyCachingRedisBusPackageVersion>0.8.3</EasyCachingRedisBusPackageVersion>
<EasyCachingCSRedisBusPackageVersion>0.8.3</EasyCachingCSRedisBusPackageVersion>
<EasyCachingRabbitBusPackageVersion>0.8.3</EasyCachingRabbitBusPackageVersion>
<EasyCachingDiskPackageVersion>0.8.3</EasyCachingDiskPackageVersion>
<EasyCachingCorePackageVersion>0.8.5</EasyCachingCorePackageVersion>
<EasyCachingMemcachedPackageVersion>0.8.5</EasyCachingMemcachedPackageVersion>
<EasyCachingRedisPackageVersion>0.8.5</EasyCachingRedisPackageVersion>
<EasyCachingSQLitePackageVersion>0.8.5</EasyCachingSQLitePackageVersion>
<EasyCachingInMemoryPackageVersion>0.8.5</EasyCachingInMemoryPackageVersion>
<EasyCachingHybridPackageVersion>0.8.5</EasyCachingHybridPackageVersion>
<EasyCachingAspectCorePackageVersion>0.8.5</EasyCachingAspectCorePackageVersion>
<EasyCachingCastlePackageVersion>0.8.5</EasyCachingCastlePackageVersion>
<EasyCachingResponseCachingPackageVersion>0.8.5</EasyCachingResponseCachingPackageVersion>
<EasyCachingJsonPackageVersion>0.8.5</EasyCachingJsonPackageVersion>
<EasyCachingMessagePackPackageVersion>0.8.5</EasyCachingMessagePackPackageVersion>
<EasyCachingProtobufPackageVersion>0.8.5</EasyCachingProtobufPackageVersion>
<EasyCachingCSRedisPackageVersion>0.8.5</EasyCachingCSRedisPackageVersion>
<EasyCachingRedisBusPackageVersion>0.8.5</EasyCachingRedisBusPackageVersion>
<EasyCachingCSRedisBusPackageVersion>0.8.5</EasyCachingCSRedisBusPackageVersion>
<EasyCachingRabbitBusPackageVersion>0.8.5</EasyCachingRabbitBusPackageVersion>
<EasyCachingDiskPackageVersion>0.8.5</EasyCachingDiskPackageVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<Folder Include="Services\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AspectCore.Extensions.Hosting" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\EasyCaching.Interceptor.Castle\EasyCaching.Interceptor.Castle.csproj" />
<ProjectReference Include="..\..\src\EasyCaching.Interceptor.AspectCore\EasyCaching.Interceptor.AspectCore.csproj" />
Expand Down
9 changes: 5 additions & 4 deletions sample/EasyCaching.Demo.Interceptors/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace EasyCaching.Demo.Interceptors
{
using AspectCore.Extensions.DependencyInjection;
using AspectCore.Extensions.Hosting;
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
Expand All @@ -18,10 +19,10 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
{
webBuilder.UseStartup<Startup>();
})
// for aspcectcore
.UseServiceProviderFactory(new AspectCoreServiceProviderFactory())
//// for castle
//.UseServiceProviderFactory(new AutofacServiceProviderFactory())
// for aspcectcore
.UseServiceContext()
//// for castle
//.UseServiceProviderFactory(new AutofacServiceProviderFactory())
;
}
}
12 changes: 6 additions & 6 deletions sample/EasyCaching.Demo.Interceptors/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EasyCaching.Demo.Interceptors
{
using AspectCore.Injector;
using AspectCore.Extensions.DependencyInjection;
using Autofac;
using EasyCaching.Core;
using EasyCaching.Demo.Interceptors.Services;
Expand Down Expand Up @@ -51,11 +51,11 @@ public void ConfigureServices(IServiceCollection services)
}

#region ConfigureContainer should be only one
// for aspectcore
public void ConfigureContainer(IServiceContainer builder)
{
builder.ConfigureAspectCoreInterceptor();
}
//// for aspectcore
//public void ConfigureContainer(IServiceContainer builder)
//{
// builder.ConfigureAspectCoreInterceptor();
//}

//// ConfigureContainer is where you can register things directly
//// with Autofac. This runs after ConfigureServices so the things
Expand Down
2 changes: 1 addition & 1 deletion src/EasyCaching.Bus.CSRedis/EasyCaching.Bus.CSRedis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.1.17" />
<PackageReference Include="CSRedisCore" Version="3.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EasyCaching.Core\EasyCaching.Core.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@

<ItemGroup>
<PackageReference Include="RabbitMQ.Client" Version="5.1.2" />
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="3.1.1" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/EasyCaching.CSRedis/DefaultCSRedisCachingProvider.Set.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public long SAdd<T>(string cacheKey, IList<T> cacheValues, TimeSpan? expiration

if (expiration.HasValue)
{
_cache.Expire(cacheKey, expiration.Value.Seconds);
_cache.Expire(cacheKey, (int)expiration.Value.TotalSeconds);
}

return len;
Expand Down Expand Up @@ -131,7 +131,7 @@ public async Task<long> SAddAsync<T>(string cacheKey, IList<T> cacheValues, Time

if (expiration.HasValue)
{
await _cache.ExpireAsync(cacheKey, expiration.Value.Seconds);
await _cache.ExpireAsync(cacheKey, (int)expiration.Value.TotalSeconds);
}

return len;
Expand Down
2 changes: 1 addition & 1 deletion src/EasyCaching.CSRedis/EasyCaching.CSRedis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.1.17" />
<PackageReference Include="CSRedisCore" Version="3.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EasyCaching.Core\EasyCaching.Core.csproj" />
Expand Down
8 changes: 4 additions & 4 deletions src/EasyCaching.Core/EasyCaching.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.1" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.7.0" />
</ItemGroup>
</Project>
26 changes: 17 additions & 9 deletions src/EasyCaching.Disk/DefaultDiskCachingProvider.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
using System.Linq;
using System.Threading.Tasks;
using EasyCaching.Core;
using MessagePack;
using MessagePack;
using MessagePack.Resolvers;
using Microsoft.Extensions.Logging;

public partial class DefaultDiskCachingProvider : EasyCachingAbstractProvider
Expand Down Expand Up @@ -63,7 +64,7 @@ public override async Task<IDictionary<string, CacheValue<T>>> BaseGetAllAsync<T

if (cached.Expiration > DateTimeOffset.UtcNow)
{
var t = MessagePackSerializer.Deserialize<T>(cached.Value, MessagePack.Resolvers.ContractlessStandardResolver.Instance);
var t = MessagePackSerializer.Deserialize<T>(cached.Value, MessagePackSerializerOptions.Standard.WithResolver(ContractlessStandardResolver.Instance));

if (!dict.ContainsKey(item))
{
Expand Down Expand Up @@ -92,12 +93,19 @@ public override async Task<CacheValue<T>> BaseGetAsync<T>(string cacheKey, Func<

if (File.Exists(path))
{
//var cached = await GetDiskCacheValueAsync(path);
var cached = GetDiskCacheValue(path);
/*
GetAsync_Parallel_Should_Succeed always failed in CI due to this reason, but succeed in local PC
MessagePack.MessagePackSerializationException : Failed to deserialize EasyCaching.Disk.DiskCacheValue value.
---- System.IO.EndOfStreamException : Attempted to read past the end of the stream.
*/
var cached = await GetDiskCacheValueAsync(path);
//var cached = GetDiskCacheValueAsync(path).ConfigureAwait(false).GetAwaiter().GetResult();
//var cached = GetDiskCacheValue(path);

if (cached.Expiration > DateTimeOffset.UtcNow)
{
var t = MessagePackSerializer.Deserialize<T>(cached.Value, MessagePack.Resolvers.ContractlessStandardResolver.Instance);
var t = MessagePackSerializer.Deserialize<T>(cached.Value, MessagePackSerializerOptions.Standard.WithResolver(ContractlessStandardResolver.Instance));

if (_options.EnableLogging)
_logger?.LogInformation($"Cache Hit : cachekey = {cacheKey}");
Expand Down Expand Up @@ -162,7 +170,7 @@ public override async Task<object> BaseGetAsync(string cacheKey, Type type)

CacheStats.OnHit();

var t = MessagePackSerializer.NonGeneric.Deserialize(type, cached.Value);
var t = MessagePackSerializer.Deserialize(type, cached.Value, MessagePackSerializerOptions.Standard.WithResolver(ContractlessStandardResolver.Instance));
return t;
}
else
Expand Down Expand Up @@ -201,7 +209,7 @@ public override async Task<CacheValue<T>> BaseGetAsync<T>(string cacheKey)

CacheStats.OnHit();

var t = MessagePackSerializer.Deserialize<T>(cached.Value, MessagePack.Resolvers.ContractlessStandardResolver.Instance);
var t = MessagePackSerializer.Deserialize<T>(cached.Value, MessagePackSerializerOptions.Standard.WithResolver(ContractlessStandardResolver.Instance));
return new CacheValue<T>(t, true);
}
else
Expand Down Expand Up @@ -242,7 +250,7 @@ public override async Task<IDictionary<string, CacheValue<T>>> BaseGetByPrefixAs

if (cached.Expiration > DateTimeOffset.UtcNow)
{
var t = MessagePackSerializer.Deserialize<T>(cached.Value, MessagePack.Resolvers.ContractlessStandardResolver.Instance);
var t = MessagePackSerializer.Deserialize<T>(cached.Value, MessagePackSerializerOptions.Standard.WithResolver(ContractlessStandardResolver.Instance));

if (!dict.ContainsKey(item))
{
Expand Down Expand Up @@ -420,7 +428,7 @@ private async Task<DiskCacheValue> GetDiskCacheValueAsync(string path)
{
using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
var cached = await MessagePackSerializer.DeserializeAsync<DiskCacheValue>(stream);
var cached = await MessagePackSerializer.DeserializeAsync<DiskCacheValue>(stream, MessagePackSerializerOptions.Standard.WithResolver(ContractlessStandardResolver.Instance));

return cached;
}
Expand Down
Loading

0 comments on commit 934c31c

Please sign in to comment.