Skip to content

Commit

Permalink
basic info add exp and perm keys related (#49)
Browse files Browse the repository at this point in the history
* basic info add exp and perm keys related
* update cli version to 0.8.1
---------
Signed-off-by: catcherwong <[email protected]>
  • Loading branch information
catcherwong authored Nov 17, 2023
1 parent eeb4fc4 commit 2cf0957
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>

<RDBParserVersion>0.6.0</RDBParserVersion>
<RDBCliVersion>0.8.0</RDBCliVersion>
<RDBCliVersion>0.8.1</RDBCliVersion>

</PropertyGroup>
</Project>
12 changes: 12 additions & 0 deletions src/RDBCli/Commands/MemoryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.CommandLine.Invocation;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.Json;
using CliCB = RDBCli.Callbacks;

Expand Down Expand Up @@ -88,6 +89,13 @@ private void Do(InvocationContext context, CommandOptions options)
dict.expiryInfo = expiryInfo;
dict.largestStreams = streamRecords;

var exp = expiryInfo.FirstOrDefault(x => x.Expiry.Equals(CommonHelper.AlreadyExpired));
var perm = expiryInfo.FirstOrDefault(x => x.Expiry.Equals(CommonHelper.Permanent));
dict.expCount = (int)(exp?.Num ?? 0);
dict.expMem = (long)(exp?.Bytes ?? 0);
dict.permCount = (int)(perm?.Num ?? 0);
dict.permMem = (long)(perm?.Bytes ?? 0);

var path = WriteFile(dict, options.Output, options.OutputType);

sw.Stop();
Expand Down Expand Up @@ -213,6 +221,10 @@ public class MemoryAnslysisResult
public int rdbVer { get; set; }
public string redisVer { get; set; }
public long redisBits { get; set; }
public int expCount { get; set; }
public int permCount { get; set; }
public long expMem { get; set; }
public long permMem { get; set; }
public List<TypeRecord> typeRecords { get; set; }
public List<Record> largestRecords { get; set; }
public List<PrefixRecord> largestKeyPrefix { get; set; }
Expand Down
Loading

0 comments on commit 2cf0957

Please sign in to comment.