Skip to content

Commit

Permalink
correcting unlink return type (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
slorello89 authored Apr 12, 2024
1 parent fd31129 commit 9412a3f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>Redis.OM.Vectorizers.AllMiniLML6V2</RootNamespace>
<PackageVersion>0.6.1</PackageVersion>
<Version>0.6.1</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.6.1</PackageReleaseNotes>
<PackageVersion>0.7.0</PackageVersion>
<Version>0.7.0</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.7.0</PackageReleaseNotes>
<Description>Sentence Vectorizer for Redis OM .NET using all-MiniLM-L6-v2</Description>
<Title>Redis OM all-MiniLM-L6-v2 Vectorizers</Title>
<Authors>Steve Lorello</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>Redis.OM.Vectorizers.Resnet18</RootNamespace>
<PackageVersion>0.6.1</PackageVersion>
<Version>0.6.1</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.6.1</PackageReleaseNotes>
<PackageVersion>0.7.0</PackageVersion>
<Version>0.7.0</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.7.0</PackageReleaseNotes>
<Description>Resnet 18 Vectorizers for Redis OM .NET.</Description>
<Title>Redis OM Resnet 18 Vectorizers</Title>
<Authors>Steve Lorello</Authors>
Expand Down
6 changes: 3 additions & 3 deletions src/Redis.OM.Vectorizers/Redis.OM.Vectorizers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>Redis.OM</RootNamespace>
<PackageVersion>0.6.1</PackageVersion>
<Version>0.6.1</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.6.1</PackageReleaseNotes>
<PackageVersion>0.7.0</PackageVersion>
<Version>0.7.0</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.7.0</PackageReleaseNotes>
<Description>Core Vectorizers for Redis OM .NET.</Description>
<Title>Redis OM Vectorizers</Title>
<Authors>Steve Lorello</Authors>
Expand Down
6 changes: 3 additions & 3 deletions src/Redis.OM/Redis.OM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<RootNamespace>Redis.OM</RootNamespace>
<Nullable>enable</Nullable>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PackageVersion>0.6.1</PackageVersion>
<Version>0.6.1</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.6.1</PackageReleaseNotes>
<PackageVersion>0.7.0</PackageVersion>
<Version>0.7.0</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.7.0</PackageReleaseNotes>
<Description>Object Mapping and More for Redis</Description>
<Title>Redis OM</Title>
<Authors>Steve Lorello</Authors>
Expand Down
8 changes: 4 additions & 4 deletions src/Redis.OM/RedisCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -740,31 +740,31 @@ public static async Task<IDictionary<string, RedisReply>> HGetAllAsync(this IRed
/// <param name="connection">the connection.</param>
/// <param name="key">the key to unlink.</param>
/// <returns>the status.</returns>
public static string Unlink(this IRedisConnection connection, string key) => connection.Execute("UNLINK", key);
public static long Unlink(this IRedisConnection connection, string key) => connection.Execute("UNLINK", key);

/// <summary>
/// Unlinks array of keys.
/// </summary>
/// <param name="connection">the connection.</param>
/// <param name="keys">the keys to unlink.</param>
/// <returns>the status.</returns>
public static string Unlink(this IRedisConnection connection, string[] keys) => connection.Execute("UNLINK", keys);
public static long Unlink(this IRedisConnection connection, string[] keys) => connection.Execute("UNLINK", keys);

/// <summary>
/// Unlinks a key.
/// </summary>
/// <param name="connection">the connection.</param>
/// <param name="key">the key to unlink.</param>
/// <returns>the status.</returns>
public static async Task<string> UnlinkAsync(this IRedisConnection connection, string key) => await connection.ExecuteAsync("UNLINK", key);
public static async Task<long> UnlinkAsync(this IRedisConnection connection, string key) => await connection.ExecuteAsync("UNLINK", key);

/// <summary>
/// Unlinks array of keys.
/// </summary>
/// <param name="connection">the connection.</param>
/// <param name="keys">the keys to unlink.</param>
/// <returns>the status.</returns>
public static async Task<string> UnlinkAsync(this IRedisConnection connection, string[] keys) => await connection.ExecuteAsync("UNLINK", keys);
public static async Task<long> UnlinkAsync(this IRedisConnection connection, string[] keys) => await connection.ExecuteAsync("UNLINK", keys);

/// <summary>
/// Unlinks the key and then adds an updated value of it.
Expand Down
14 changes: 14 additions & 0 deletions test/Redis.OM.Unit.Tests/CoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,5 +479,19 @@ public async Task SearchTimeoutTest()
var ex = await Assert.ThrowsAsync<Exception>(async () => await collection.Take(10000).ToListAsync());
Assert.True(ex.Message.Equals("Encountered timeout when searching - check the duration of your query.") || ex.Message.Contains("Timeout limit was reached"));
}

[Fact]
public void TestUnlink()
{
string key1 = $"test:{Ulid.NewUlid()}";
string key2 = $"test:{Ulid.NewUlid()}";
var hostInfo = Environment.GetEnvironmentVariable("STANDALONE_HOST_PORT") ?? "localhost:6379";
var provider = new RedisConnectionProvider($"redis://{hostInfo}");
var connection = provider.Connection;
var res = connection.Unlink(key1);
Assert.Equal(0, res);
connection.Execute("SET", key1, "bar");
Assert.Equal(1,connection.Unlink(new []{key1, key2}));
}
}
}

0 comments on commit 9412a3f

Please sign in to comment.