Skip to content

Commit

Permalink
Merge pull request #19 from Devwarlt/dev
Browse files Browse the repository at this point in the history
PSTk.Redis: support for subscription feature
  • Loading branch information
Devwarlt authored Mar 10, 2021
2 parents ca85191 + d7f3b3a commit c28d22b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion PSTk.Core/PSTk.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<PackageId>PSTk.Core</PackageId>
<ApplicationIcon>ICON.ico</ApplicationIcon>
<Version>1.1.2</Version>
<Version>1.1.3</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
10 changes: 9 additions & 1 deletion PSTk.Redis/Database/RedisEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public sealed class RedisEngine

private IConnectionMultiplexer connectionMultiplexer;
private IDatabase database;
private ISubscriber subscriber;

#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

Expand All @@ -32,6 +33,11 @@ public sealed class RedisEngine
/// </summary>
public bool IsConnected => connectionMultiplexer != null && connectionMultiplexer.IsConnected;

/// <summary>
/// Gets <see cref="ISubscriber"/> of current <see cref="IDatabase"/> instance.
/// </summary>
public ISubscriber Subscriber => subscriber;

/// <summary>
/// Tries to close <see cref="IConnectionMultiplexer"/> connection synchronously.
/// </summary>
Expand All @@ -51,7 +57,7 @@ public async void CloseAsync()
if (!IsConnected)
return;

connectionMultiplexer.CloseAsync();
await connectionMultiplexer.CloseAsync();
}

/// <summary>
Expand All @@ -70,6 +76,7 @@ public void Start()
var connectionStr = GetConnectionStrings();
connectionMultiplexer = ConnectionMultiplexer.Connect(connectionStr);
database = connectionMultiplexer.GetDatabase(redisSettings.Index);
subscriber = connectionMultiplexer.GetSubscriber();
}
catch (RedisConnectionException e)
{
Expand All @@ -91,6 +98,7 @@ public async void StartAsync()
var connectionStr = GetConnectionStrings();
connectionMultiplexer = await ConnectionMultiplexer.ConnectAsync(connectionStr);
database = connectionMultiplexer.GetDatabase(redisSettings.Index);
subscriber = connectionMultiplexer.GetSubscriber();
}
catch (RedisConnectionException e)
{
Expand Down
2 changes: 1 addition & 1 deletion PSTk.Redis/PSTk.Redis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<RepositoryType>Git</RepositoryType>
<PackageTags>dotnet;toolkit;game-tools;pserver</PackageTags>
<ApplicationIcon>ICON.ico</ApplicationIcon>
<Version>1.0.1</Version>
<Version>1.1.1</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
4 changes: 2 additions & 2 deletions nuget-push-all.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ IF "%~2"=="" (SET /P TOKEN="Enter API token: ")

ECHO.

SET CORE_PKG_VERSION=1.1.2
SET CORE_PKG_VERSION=1.1.3
SET DIAGNOSTICS_PKG_VERSION=1.2.0
SET EXTENSIONS_PKG_VERSION=1.2.0
SET NETWORKING_PKG_VERSION=1.1.0
SET REDIS_PKG_VERSION=1.0.0
SET REDIS_PKG_VERSION=1.1.1
SET THREADING_PKG_VERSION=1.3.0

ECHO Packing all distributions...
Expand Down

0 comments on commit c28d22b

Please sign in to comment.