Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
03cd525f
Unverified
Commit
03cd525f
authored
May 03, 2024
by
debing.sun
Committed by
GitHub
May 03, 2024
Browse files
Fix reply schema for hfe related commands (#13238)
parent
c33c91db
Changes
10
Show whitespace changes
Inline
Side-by-side
src/commands/hexpire.json
View file @
03cd525f
...
@@ -46,7 +46,8 @@
...
@@ -46,7 +46,8 @@
"type"
:
"array"
,
"type"
:
"array"
,
"minItems"
:
1
,
"minItems"
:
1
,
"maxItems"
:
4294967295
,
"maxItems"
:
4294967295
,
"items"
:
[
"items"
:
{
"oneOf"
:
[
{
{
"description"
:
"The field does not exist."
,
"description"
:
"The field does not exist."
,
"const"
:
-2
"const"
:
-2
...
@@ -65,6 +66,7 @@
...
@@ -65,6 +66,7 @@
}
}
]
]
}
}
}
]
]
},
},
"arguments"
:
[
"arguments"
:
[
...
...
src/commands/hexpireat.json
View file @
03cd525f
...
@@ -46,7 +46,8 @@
...
@@ -46,7 +46,8 @@
"type"
:
"array"
,
"type"
:
"array"
,
"minItems"
:
1
,
"minItems"
:
1
,
"maxItems"
:
4294967295
,
"maxItems"
:
4294967295
,
"items"
:
[
"items"
:
{
"oneOf"
:
[
{
{
"description"
:
"The field does not exist."
,
"description"
:
"The field does not exist."
,
"const"
:
-2
"const"
:
-2
...
@@ -65,6 +66,7 @@
...
@@ -65,6 +66,7 @@
}
}
]
]
}
}
}
]
]
},
},
"arguments"
:
[
"arguments"
:
[
...
...
src/commands/hexpiretime.json
View file @
03cd525f
...
@@ -45,7 +45,8 @@
...
@@ -45,7 +45,8 @@
"type"
:
"array"
,
"type"
:
"array"
,
"minItems"
:
1
,
"minItems"
:
1
,
"maxItems"
:
4294967295
,
"maxItems"
:
4294967295
,
"items"
:
[
"items"
:
{
"oneOf"
:
[
{
{
"description"
:
"The field does not exist."
,
"description"
:
"The field does not exist."
,
"const"
:
-2
"const"
:
-2
...
@@ -61,6 +62,7 @@
...
@@ -61,6 +62,7 @@
}
}
]
]
}
}
}
]
]
},
},
"arguments"
:
[
"arguments"
:
[
...
...
src/commands/hpersist.json
View file @
03cd525f
...
@@ -45,7 +45,8 @@
...
@@ -45,7 +45,8 @@
"type"
:
"array"
,
"type"
:
"array"
,
"minItems"
:
1
,
"minItems"
:
1
,
"maxItems"
:
4294967295
,
"maxItems"
:
4294967295
,
"items"
:
[
"items"
:
{
"oneOf"
:
[
{
{
"description"
:
"The field does not exist."
,
"description"
:
"The field does not exist."
,
"const"
:
-2
"const"
:
-2
...
@@ -60,6 +61,7 @@
...
@@ -60,6 +61,7 @@
}
}
]
]
}
}
}
]
]
},
},
"arguments"
:
[
"arguments"
:
[
...
...
src/commands/hpexpire.json
View file @
03cd525f
...
@@ -46,7 +46,8 @@
...
@@ -46,7 +46,8 @@
"type"
:
"array"
,
"type"
:
"array"
,
"minItems"
:
1
,
"minItems"
:
1
,
"maxItems"
:
4294967295
,
"maxItems"
:
4294967295
,
"items"
:
[
"items"
:
{
"oneOf"
:
[
{
{
"description"
:
"The field does not exist."
,
"description"
:
"The field does not exist."
,
"const"
:
-2
"const"
:
-2
...
@@ -65,6 +66,7 @@
...
@@ -65,6 +66,7 @@
}
}
]
]
}
}
}
]
]
},
},
"arguments"
:
[
"arguments"
:
[
...
...
src/commands/hpexpireat.json
View file @
03cd525f
...
@@ -46,7 +46,8 @@
...
@@ -46,7 +46,8 @@
"type"
:
"array"
,
"type"
:
"array"
,
"minItems"
:
1
,
"minItems"
:
1
,
"maxItems"
:
4294967295
,
"maxItems"
:
4294967295
,
"items"
:
[
"items"
:
{
"oneOf"
:
[
{
{
"description"
:
"The field does not exist."
,
"description"
:
"The field does not exist."
,
"const"
:
-2
"const"
:
-2
...
@@ -65,6 +66,7 @@
...
@@ -65,6 +66,7 @@
}
}
]
]
}
}
}
]
]
},
},
"arguments"
:
[
"arguments"
:
[
...
...
src/commands/hpexpiretime.json
View file @
03cd525f
...
@@ -45,7 +45,8 @@
...
@@ -45,7 +45,8 @@
"type"
:
"array"
,
"type"
:
"array"
,
"minItems"
:
1
,
"minItems"
:
1
,
"maxItems"
:
4294967295
,
"maxItems"
:
4294967295
,
"items"
:
[
"items"
:
{
"oneOf"
:
[
{
{
"description"
:
"The field does not exist."
,
"description"
:
"The field does not exist."
,
"const"
:
-2
"const"
:
-2
...
@@ -61,6 +62,7 @@
...
@@ -61,6 +62,7 @@
}
}
]
]
}
}
}
]
]
},
},
"arguments"
:
[
"arguments"
:
[
...
...
src/commands/hpttl.json
View file @
03cd525f
...
@@ -45,7 +45,8 @@
...
@@ -45,7 +45,8 @@
"type"
:
"array"
,
"type"
:
"array"
,
"minItems"
:
1
,
"minItems"
:
1
,
"maxItems"
:
4294967295
,
"maxItems"
:
4294967295
,
"items"
:
[
"items"
:
{
"oneOf"
:
[
{
{
"description"
:
"The field does not exist."
,
"description"
:
"The field does not exist."
,
"const"
:
-2
"const"
:
-2
...
@@ -61,6 +62,7 @@
...
@@ -61,6 +62,7 @@
}
}
]
]
}
}
}
]
]
},
},
"arguments"
:
[
"arguments"
:
[
...
...
src/commands/httl.json
View file @
03cd525f
...
@@ -45,7 +45,8 @@
...
@@ -45,7 +45,8 @@
"type"
:
"array"
,
"type"
:
"array"
,
"minItems"
:
1
,
"minItems"
:
1
,
"maxItems"
:
4294967295
,
"maxItems"
:
4294967295
,
"items"
:
[
"items"
:
{
"oneOf"
:
[
{
{
"description"
:
"The field does not exist."
,
"description"
:
"The field does not exist."
,
"const"
:
-2
"const"
:
-2
...
@@ -61,6 +62,7 @@
...
@@ -61,6 +62,7 @@
}
}
]
]
}
}
}
]
]
},
},
"arguments"
:
[
"arguments"
:
[
...
...
tests/unit/type/hash-field-expire.tcl
View file @
03cd525f
...
@@ -88,41 +88,63 @@ start_server {tags {"external:skip needs:debug"}} {
...
@@ -88,41 +88,63 @@ start_server {tags {"external:skip needs:debug"}} {
# Currently listpack doesn't support HFE
# Currently listpack doesn't support HFE
r config set hash-max-listpack-entries 0
r config set hash-max-listpack-entries 0
test
{
HPEXPIRE - Test 'NX' flag
}
{
test
{
HPEXPIRE
(
AT
)
- Test 'NX' flag
}
{
r del myhash
r del myhash
r hset myhash field1 value1 field2 value2 field3 value3
r hset myhash field1 value1 field2 value2 field3 value3
assert_equal
[
r hpexpire myhash 1000 NX 1 field1
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 1000 NX 1 field1
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 1000 NX 2 field1 field2
]
[
list $E_FAIL $E_OK
]
assert_equal
[
r hpexpire myhash 1000 NX 2 field1 field2
]
[
list $E_FAIL $E_OK
]
r del myhash
r hset myhash field1 value1 field2 value2 field3 value3
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+1000
)
*1000
}]
NX 1 field1
]
[
list $E_OK
]
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+1000
)
*1000
}]
NX 2 field1 field2
]
[
list $E_FAIL $E_OK
]
}
}
test
{
HPEXPIRE - Test 'XX' flag
}
{
test
{
HPEXPIRE
(
AT
)
- Test 'XX' flag
}
{
r del myhash
r del myhash
r hset myhash field1 value1 field2 value2 field3 value3
r hset myhash field1 value1 field2 value2 field3 value3
assert_equal
[
r hpexpire myhash 1000 NX 2 field1 field2
]
[
list $E_OK $E_OK
]
assert_equal
[
r hpexpire myhash 1000 NX 2 field1 field2
]
[
list $E_OK $E_OK
]
assert_equal
[
r hpexpire myhash 1000 XX 2 field1 field3
]
[
list $E_OK $E_FAIL
]
assert_equal
[
r hpexpire myhash 1000 XX 2 field1 field3
]
[
list $E_OK $E_FAIL
]
r del myhash
r hset myhash field1 value1 field2 value2 field3 value3
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+1000
)
*1000
}]
NX 2 field1 field2
]
[
list $E_OK $E_OK
]
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+1000
)
*1000
}]
XX 2 field1 field3
]
[
list $E_OK $E_FAIL
]
}
}
test
{
HPEXPIRE - Test 'GT' flag
}
{
test
{
HPEXPIRE
(
AT
)
- Test 'GT' flag
}
{
r del myhash
r del myhash
r hset myhash field1 value1 field2 value2
r hset myhash field1 value1 field2 value2
assert_equal
[
r hpexpire myhash 1000 NX 1 field1
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 1000 NX 1 field1
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 2000 NX 1 field2
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 2000 NX 1 field2
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 1500 GT 2 field1 field2
]
[
list $E_OK $E_FAIL
]
assert_equal
[
r hpexpire myhash 1500 GT 2 field1 field2
]
[
list $E_OK $E_FAIL
]
r del myhash
r hset myhash field1 value1 field2 value2
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+1000
)
*1000
}]
NX 1 field1
]
[
list $E_OK
]
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+2000
)
*1000
}]
NX 1 field2
]
[
list $E_OK
]
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+1500
)
*1000
}]
GT 2 field1 field2
]
[
list $E_OK $E_FAIL
]
}
}
test
{
HPEXPIRE - Test 'LT' flag
}
{
test
{
HPEXPIRE
(
AT
)
- Test 'LT' flag
}
{
r del myhash
r del myhash
r hset myhash field1 value1 field2 value2
r hset myhash field1 value1 field2 value2
assert_equal
[
r hpexpire myhash 1000 NX 1 field1
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 1000 NX 1 field1
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 2000 NX 1 field2
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 2000 NX 1 field2
]
[
list $E_OK
]
assert_equal
[
r hpexpire myhash 1500 LT 2 field1 field2
]
[
list $E_FAIL $E_OK
]
assert_equal
[
r hpexpire myhash 1500 LT 2 field1 field2
]
[
list $E_FAIL $E_OK
]
r del myhash
r hset myhash field1 value1 field2 value2
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+1000
)
*1000
}]
NX 1 field1
]
[
list $E_OK
]
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+2000
)
*1000
}]
NX 1 field2
]
[
list $E_OK
]
assert_equal
[
r hpexpireat myhash
[
expr
{([
clock seconds
]
+1500
)
*1000
}]
LT 2 field1 field2
]
[
list $E_FAIL $E_OK
]
}
}
test
{
HPEXPIREAT - field not exists or TTL is in the past
}
{
test
{
HPEXPIREAT - field not exists or TTL is in the past
}
{
r del myhash
r del myhash
r hset myhash f1 v1 f2 v2 f4 v4
r hset myhash f1 v1 f2 v2 f4 v4
r hexpire myhash 1000 NX 1 f4
r hexpire myhash 1000 NX 1 f4
assert_equal
[
r hexpireat myhash
[
expr
{[
clock seconds
]
- 1
}]
NX 4 f1 f2 f3 f4
]
"
$
E_DELETED
$
E_DELETED
$
E_NO_FIELD
$
E_FAIL"
assert_equal
[
r h
p
expireat myhash
[
expr
{
(
[
clock seconds
]
-1
)
*1000
}]
NX 4 f1 f2 f3 f4
]
"
$
E_DELETED
$
E_DELETED
$
E_NO_FIELD
$
E_FAIL"
assert_equal
[
r hexists myhash field1
]
0
assert_equal
[
r hexists myhash field1
]
0
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment