Skip to content

Commit

Permalink
修改生成缓存键值的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
yihango committed Jun 2, 2021
1 parent 9ae5f1c commit 79cd8fa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
36 changes: 36 additions & 0 deletions src/LiteIM.CSRedisCore/Extensions/CSRedisCoreImKeysExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace LiteIM.Extensions
{
public static class CSRedisCoreImKeysExtensions
{
public static string CSRedisCoreChan(this string prefix, string end)
{
return $"n:{prefix}LiteIM,c:{string.Empty.Chan(end)}";
}

public static string CSRedisCoreClient(this string prefix, string end)
{
return $"n:{prefix}LiteIM,c:{string.Empty.Client(end)}";
}

public static string CSRedisCoreListChan(this string prefix)
{
return $"n:{prefix}LiteIM,c:{string.Empty.ListChan()}";
}

public static string CSRedisCoreOnline(this string prefix)
{
return $"n:{prefix}LiteIM,c:{string.Empty.Online()}";
}

public static string CSRedisCoreOffline(this string prefix)
{
return $"n:{prefix}LiteIM,c:{string.Empty.Offline()}";
}
}


}
10 changes: 5 additions & 5 deletions src/LiteIM.Core/Extensions/ImKeysExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ public static class ImKeysExtensions
{
public static string Chan(this string prefix, string end)
{
return $"n:{prefix}LiteIM,c:{ImConsts.Chan}{end}";
return $"{prefix}{ImConsts.Chan}_{end}";
}

public static string Client(this string prefix, string end)
{
return $"n:{prefix}LiteIM,c:{ImConsts.Client}{end}";
return $"{prefix}{ImConsts.Client}_{end}";
}

public static string ListChan(this string prefix)
{
return $"n:{prefix}LiteIM,c:{ImConsts.ListChan}";
return $"{prefix}{ImConsts.ListChan}";
}

public static string Online(this string prefix)
{
return $"n:{prefix}LiteIM,c:{ImConsts.Online}";
return $"{prefix}{ImConsts.Online}";
}

public static string Offline(this string prefix)
{
return $"n:{prefix}LiteIM,c:{ImConsts.Offline}";
return $"{prefix}{ImConsts.Offline}";
}
}

Expand Down

0 comments on commit 79cd8fa

Please sign in to comment.