@@ -19,7 +19,13 @@ Options:
1919 -sep separator for flamegraph, rdb will separate key by it, default value is ":".
2020 supporting multi separators: -sep sep1 -sep sep2
2121 -regex using regex expression filter keys
22- -no-expired filter expired keys
22+ -expire filter keys by its expiration time
23+ 1. '1751731200~1751817600' get keys with expiration time in range [1751731200, 1751817600]
24+ 2. '1751731200~now' 'now~1751731200' magic variable 'now' represents the current timestamp
25+ 3. '1751731200~inf' 'now~inf' magic variable 'inf' represents the Infinity
26+ 4. 'noexpire' get keys without expiration time
27+ 5. 'anyexpire' get all keys with expiration time
28+ -no-expired filter expired keys(deprecated, please use 'expire' option)
2329 -concurrent The number of concurrent json converters. 4 by default.
2430
2531Examples:
@@ -58,6 +64,7 @@ func main() {
5864 var seps separators
5965 var regexExpr string
6066 var noExpired bool
67+ var expirationExpr string
6168 var maxDepth int
6269 var concurrent int
6370 var err error
@@ -69,7 +76,8 @@ func main() {
6976 flagSet .IntVar (& concurrent , "concurrent" , 0 , "concurrent number for json converter" )
7077 flagSet .Var (& seps , "sep" , "separator for flame graph" )
7178 flagSet .StringVar (& regexExpr , "regex" , "" , "regex expression" )
72- flagSet .BoolVar (& noExpired , "no-expired" , false , "filter expired keys" )
79+ flagSet .StringVar (& expirationExpr , "expire" , "" , "expiration filter expression" )
80+ flagSet .BoolVar (& noExpired , "no-expired" , false , "filter expired keys(deprecated, please use expire)" )
7381 _ = flagSet .Parse (os .Args [1 :]) // ExitOnError
7482 src := flagSet .Arg (0 )
7583
@@ -92,6 +100,9 @@ func main() {
92100 if concurrent != 0 {
93101 options = append (options , helper .WithConcurrent (concurrent ))
94102 }
103+ if expirationExpr != "" {
104+ options = append (options , helper .WithExpirationOption (expirationExpr ))
105+ }
95106
96107 var outputFile * os.File
97108 if output == "" {
0 commit comments