Skip to content

Commit

Permalink
0.0.1-preview.313
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeLyn committed Mar 22, 2019
1 parent a823d2f commit 92847a2
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 20 deletions.
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/Uragano.Abstract/Uragano.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>7.1</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<Description>A simple, high performance RPC library.</Description>
<PackageProjectUrl>https://github.com/ww198643/Uragano</PackageProjectUrl>
<PackageTags>Uragano,RPC,DotNetty,Microservice,MessagePack,DynamicProxy</PackageTags>
Expand Down
2 changes: 1 addition & 1 deletion src/Uragano.Caching.Memory/Uragano.Caching.Memory.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<Authors>Owen</Authors>
<Company>Owen</Company>
<Description>A simple, high performance RPC library.</Description>
Expand Down
12 changes: 9 additions & 3 deletions src/Uragano.Caching.Redis/RedisCaching.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
using System;
using System.Threading.Tasks;
using Uragano.Abstractions;
using Uragano.Codec.MessagePack;

namespace Uragano.Caching.Redis
{
public class RedisCaching : ICaching
{
private ICodec Codec { get; }

public RedisCaching(ICodec codec)
{
Codec = codec;
}

public async Task Set<TValue>(string key, TValue value, int expireSeconds = -1)
{
await RedisHelper.SetAsync(key, SerializerHelper.Serialize(value), expireSeconds);
await RedisHelper.SetAsync(key, Codec.Serialize(value), expireSeconds);
}

public async Task<(object value, bool hasKey)> Get(string key, Type type)
{
var bytes = await RedisHelper.GetAsync<byte[]>(key);
if (bytes == null || bytes.LongLength == 0)
return (null, false);
return (SerializerHelper.Deserialize(bytes), true);
return (Codec.Deserialize(bytes, type), true);
}

public async Task<(TValue value, bool hasKey)> Get<TValue>(string key)
Expand Down
12 changes: 7 additions & 5 deletions src/Uragano.Caching.Redis/RedisPartitionCaching.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection;
using Uragano.Abstractions;
using Uragano.Codec.MessagePack;

namespace Uragano.Caching.Redis
{
public class RedisPartitionCaching : ICaching
{
private IDistributedCache Cache { get; }

public RedisPartitionCaching(UraganoSettings uraganoSettings, IServiceProvider serviceProvider)
private ICodec Codec { get; }

public RedisPartitionCaching(UraganoSettings uraganoSettings, IServiceProvider serviceProvider, ICodec codec)
{
Codec = codec;
var redisOptions = (RedisOptions)uraganoSettings.CachingOptions;
var policy = serviceProvider.GetService<Func<string, IEnumerable<RedisConnection>, RedisConnection>>();
if (policy != null)
Expand All @@ -39,20 +41,20 @@ string NodeRule(string key)
public async Task Set<TValue>(string key, TValue value, int expireSeconds = -1)
{
if (expireSeconds > 0)
await Cache.SetAsync(key, SerializerHelper.Serialize(value), new DistributedCacheEntryOptions
await Cache.SetAsync(key, Codec.Serialize(value), new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = expireSeconds <= 0 ? default : TimeSpan.FromSeconds(expireSeconds)
});
else
await Cache.SetAsync(key, SerializerHelper.Serialize(value));
await Cache.SetAsync(key, Codec.Serialize(value));
}

public async Task<(object value, bool hasKey)> Get(string key, Type type)
{
var bytes = await Cache.GetAsync(key);
if (bytes == null || bytes.LongLength == 0)
return (null, false);
return (SerializerHelper.Deserialize(bytes), true);
return (Codec.Deserialize(bytes, type), true);
}

public async Task<(TValue value, bool hasKey)> Get<TValue>(string key)
Expand Down
3 changes: 1 addition & 2 deletions src/Uragano.Caching.Redis/Uragano.Caching.Redis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<Authors>Owen</Authors>
<Company>Owen</Company>
<Description>A simple, high performance RPC library.</Description>
Expand All @@ -20,7 +20,6 @@

<ItemGroup>
<ProjectReference Include="..\Uragano.Abstract\Uragano.Abstractions.csproj" />
<ProjectReference Include="..\Uragano.Codec.MessagePack\Uragano.Codec.MessagePack.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<Description>A simple, high performance RPC library.</Description>
<PackageProjectUrl>https://github.com/ww198643/Uragano</PackageProjectUrl>
<PackageIconUrl>https://github.com/ww198643/Uragano/blob/master/icon.png?raw=true</PackageIconUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/Uragano.Consul/Uragano.Consul.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageTags>Uragano,RPC,DotNetty,Microservice,MessagePack,DynamicProxy</PackageTags>
<PackageProjectUrl>https://github.com/ww198643/Uragano</PackageProjectUrl>
<Description>A simple, high performance RPC library.</Description>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<PackageLicenseUrl>https://github.com/ww198643/Uragano/blob/master/LICENSE</PackageLicenseUrl>
<Authors>Owen</Authors>
<Company>Owen</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/Uragano.Core/Uragano.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PackageIconUrl>https://github.com/ww198643/Uragano/blob/master/icon.png?raw=true</PackageIconUrl>
<PackageProjectUrl>https://github.com/ww198643/Uragano</PackageProjectUrl>
<Description>A simple, high performance RPC library.</Description>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<PackageLicenseUrl>https://github.com/ww198643/Uragano/blob/master/LICENSE</PackageLicenseUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Owen</Authors>
Expand Down
2 changes: 1 addition & 1 deletion src/Uragano.DynamicProxy/Uragano.DynamicProxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageIconUrl>https://github.com/ww198643/Uragano/blob/master/icon.png?raw=true</PackageIconUrl>
<PackageProjectUrl>https://github.com/ww198643/Uragano</PackageProjectUrl>
<Description>A simple, high performance RPC library.</Description>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<PackageLicenseUrl>https://github.com/ww198643/Uragano/blob/master/LICENSE</PackageLicenseUrl>
<Authors>Owen</Authors>
<Company>Owen</Company>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<Authors>Owen</Authors>
<Company>Owen</Company>
<Description>A simple, high performance RPC library.</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/Uragano.Logging.Log4net/Uragano.Logging.Log4Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<Authors>Owen</Authors>
<Company>Owen</Company>
<Description>A simple, high performance RPC library.</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/Uragano.Logging.NLog/Uragano.Logging.NLog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<Authors>Owen</Authors>
<Company>Owen</Company>
<Description>A simple, high performance RPC library.</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/Uragano.Remoting/Uragano.Remoting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageIconUrl>https://github.com/ww198643/Uragano/blob/master/icon.png?raw=true</PackageIconUrl>
<PackageProjectUrl>https://github.com/ww198643/Uragano</PackageProjectUrl>
<Description>A simple, high performance RPC library.</Description>
<Version>0.0.1-preview.312</Version>
<Version>0.0.1-preview.313</Version>
<PackageLicenseUrl>https://github.com/ww198643/Uragano/blob/master/LICENSE</PackageLicenseUrl>
<Authors>Owen</Authors>
<Company>Owen</Company>
Expand Down

0 comments on commit 92847a2

Please sign in to comment.