Skip to content

Commit

Permalink
bugfixing
Browse files Browse the repository at this point in the history
  • Loading branch information
imperugo committed Oct 9, 2019
1 parent 314dc97 commit dfd95a6
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Title>StackExchange.Redis.Extensions.AspNetCore is a library that has a set of extensions method fpr ASP.NET Core.</Title>
<Summary>StackExchange.Redis.Extensions.AspNetCore is a library that has a set of extensions method fpr ASP.NET Core with the scope to simply the library configuration into the dependency injection</Summary>
<Description>StackExchange.Redis.Extensions.AspNetCore is a library that has a set of extensions method fpr ASP.NET Core</Description>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionPrefix>5.3.0</VersionPrefix>
<!--<VersionSuffix>pre</VersionSuffix>-->
<Authors>Ugo Lattanzi</Authors>
<Copyright>Ugo Lattanzi</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Description>StackExchange.Redis.Extensions is a library that extends StackExchange.Redis allowing you a set of functionality needed by common applications.

This implementation is based on Microsoft's BinarySerializer</Description>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionPrefix>5.3.0</VersionPrefix>
<!--<VersionSuffix>pre</VersionSuffix>-->
<Authors>Ugo Lattanzi</Authors>
<Copyright>Ugo Lattanzi</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ public class RedisConfiguration
private ServerEnumerationStrategy serverEnumerationStrategy;
private int poolSize = 5;
private string[] excludeCommands;
private string configurationChannel = null;

/// <summary>
/// The key separation prefix used for all cache entries
/// </summary>
public string ConfigurationChannel
{
get => configurationChannel;
set
{
configurationChannel = value;
ResetConfigurationOptions();
}
}

/// <summary>
/// The key separation prefix used for all cache entries
Expand Down Expand Up @@ -208,6 +222,7 @@ public ConfigurationOptions ConfigurationOptions
ConnectTimeout = ConnectTimeout,
SyncTimeout = SyncTimeout,
AbortOnConnectFail = AbortOnConnectFail,
ConfigurationChannel = ConfigurationChannel
};

if (ExcludeCommands != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public async Task<T> GetAsync<T>(string key, DateTimeOffset expiresAt, CommandFl
if (!Equals(result, default(T)))
await Database.KeyExpireAsync(key, expiresAt.UtcDateTime.Subtract(DateTime.UtcNow));

return default;
return result;
}

public async Task<T> GetAsync<T>(string key, TimeSpan expiresIn, CommandFlags flag = CommandFlags.None)
Expand All @@ -131,7 +131,7 @@ public async Task<T> GetAsync<T>(string key, TimeSpan expiresIn, CommandFlags fl
if (!Equals(result, default(T)))
await Database.KeyExpireAsync(key, expiresIn);

return default;
return result;
}

public bool Add<T>(string key, T value, When when = When.Always, CommandFlags flag = CommandFlags.None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To store complex data It requires one of the following implementations:
- StackExchange.Redis.Extensions.Protobuf
- StackExchange.Redis.Extensions.Utf8Json
- StackExchange.Redis.Extensions.Binary</Description>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionPrefix>5.3.0</VersionPrefix>
<!--<VersionSuffix>pre</VersionSuffix>-->
<IncludeSource>false</IncludeSource>
<IncludeSymbols>true</IncludeSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public async Task<T> GetAsync<T>(string key, DateTimeOffset expiresAt, CommandFl
await Database.KeyExpireAsync(key, expiresAt.Subtract(DateTime.Now));
}

return default(T);
return result;
}

/// <summary>
Expand All @@ -378,7 +378,7 @@ public async Task<T> GetAsync<T>(string key, TimeSpan expiresIn, CommandFlags fl
await Database.KeyExpireAsync(key, expiresIn);
}

return default(T);
return result;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Description>StackExchange.Redis.Extensions is a library that extends StackExchange.Redis allowing you a set of functionality needed by common applications.

This implementation is based on Jil serializer.</Description>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionPrefix>5.3.0</VersionPrefix>
<!--<VersionSuffix>pre</VersionSuffix>-->
<Authors>Ugo Lattanzi</Authors>
<Copyright>Ugo Lattanzi</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>StackExchange.Redis.Extensions.LegacyConfiguration</id>
<title>StackExchange.Redis.Extensions.LegacyConfiguration</title>
<version>5.2.0</version>
<version>5.3.0</version>
<authors>Ugo Lattanzi</authors>
<owners>Ugo Lattanzi</owners>
<licenseUrl>https://github.com/imperugo/StackExchange.Redis.Extensions/blob/master/LICENSE</licenseUrl>
Expand All @@ -23,7 +23,7 @@
<language>en-US</language>
<tags>Async Redis NoSQL Client Distributed Cache PubSub Messaging</tags>
<dependencies>
<dependency id="StackExchange.Redis.Extensions.Core" version="5.2.0" />
<dependency id="StackExchange.Redis.Extensions.Core" version="5.3.0" />
</dependencies>
</metadata>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Description>StackExchange.Redis.Extensions is a library that extends StackExchange.Redis allowing you a set of functionality needed by common applications.

This implementation is based on MsgPack serializer.</Description>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionPrefix>5.3.0</VersionPrefix>
<!--<VersionSuffix>pre</VersionSuffix>-->
<Authors>Ugo Lattanzi</Authors>
<Copyright>Ugo Lattanzi</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Description>StackExchange.Redis.Extensions is a library that extends StackExchange.Redis allowing you a set of functionality needed by common applications.

This implementation is based on Newtonsoft Json.Net serializer.</Description>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionPrefix>5.3.0</VersionPrefix>
<!--<VersionSuffix>pre</VersionSuffix>-->
<Authors>Ugo Lattanzi</Authors>
<Copyright>Ugo Lattanzi</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Description>StackExchange.Redis.Extensions is a library that extends StackExchange.Redis allowing you a set of functionality needed by common applications.

This implementation is based on Protobuf serializer.</Description>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionPrefix>5.3.0</VersionPrefix>
<!--<VersionSuffix>pre</VersionSuffix>-->
<Authors>Ugo Lattanzi</Authors>
<Copyright>Ugo Lattanzi</Copyright>
Expand Down Expand Up @@ -52,7 +52,7 @@ This implementation is based on Protobuf serializer.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="protobuf-net" Version="2.4.0" />
<PackageReference Include="protobuf-net" Version="2.4.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Description>StackExchange.Redis.Extensions is a library that extends StackExchange.Redis allowing you a set of functionality needed by common applications.

This implementation is based on UTF8Json serializer.</Description>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionPrefix>5.3.0</VersionPrefix>
<!--<VersionSuffix>pre</VersionSuffix>-->
<Authors>Ugo Lattanzi</Authors>
<Copyright>Ugo Lattanzi</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,25 @@ public async Task SearchKeys_With_Key_Prefix_Should_Return_All_Database_Keys()
Assert.True(keys.Count() == 2);
}

[Fact]
[Fact]
public async Task SearchKeys_With_Start_Should_Return_All_Keys()
{
var values = Range(0, 10)
.Select(i => new TestClass<string>($"mykey{i}", Guid.NewGuid().ToString()))
.ToArray();

foreach (var x in values)
{
await Db.StringSetAsync(x.Key, x.Value);
}

var result = (await Sut.GetDbFromConfiguration().SearchKeysAsync("*")).OrderBy(k => k).ToList();

Assert.True(result.Count == 10);
}


[Fact]
public async Task SearchKeys_With_Key_Prefix_Should_Return_Keys_Without_Prefix()
{
var values = Range(0, 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Jil" Version="2.17.0" />
<PackageReference Include="MsgPack.Cli" Version="1.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="protobuf-net" Version="2.4.0" />
<PackageReference Include="protobuf-net" Version="2.4.1" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
Expand Down

0 comments on commit dfd95a6

Please sign in to comment.