@@ -1120,7 +1120,7 @@ async def httl(self, key: TEncodable, fields: List[TEncodable]) -> List[int]:
11201120 - `-2`: field does not exist or key does not exist
11211121
11221122 Examples:
1123- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.EX , 10))
1123+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.SEC , 10))
11241124 >>> await client.httl("my_hash", ["field1", "field2", "non_existent_field"])
11251125 [9, 9, -2] # field1 and field2 have ~9 seconds left, non_existent_field doesn't exist
11261126
@@ -1150,7 +1150,7 @@ async def hpttl(self, key: TEncodable, fields: List[TEncodable]) -> List[int]:
11501150 - `-2`: field does not exist or key does not exist
11511151
11521152 Examples:
1153- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.PX , 10000))
1153+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.MILLSEC , 10000))
11541154 >>> await client.hpttl("my_hash", ["field1", "field2", "non_existent_field"])
11551155 [9500, 9500, -2] # field1 and field2 have ~9500 milliseconds left, non_existent_field doesn't exist
11561156
@@ -1182,7 +1182,7 @@ async def hexpiretime(self, key: TEncodable, fields: List[TEncodable]) -> List[i
11821182 Examples:
11831183 >>> import time
11841184 >>> future_timestamp = int(time.time()) + 60 # 60 seconds from now
1185- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.EXAT , future_timestamp))
1185+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.UNIX_SEC , future_timestamp))
11861186 >>> await client.hexpiretime("my_hash", ["field1", "field2", "non_existent_field"])
11871187 [future_timestamp, future_timestamp, -2] # field1 and field2 expire at future_timestamp, non_existent_field doesn't exist
11881188
@@ -1216,7 +1216,7 @@ async def hpexpiretime(
12161216 Examples:
12171217 >>> import time
12181218 >>> future_timestamp_ms = int(time.time() * 1000) + 60000 # 60 seconds from now in milliseconds
1219- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.PXAT , future_timestamp_ms))
1219+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.UNIX_MILLSEC , future_timestamp_ms))
12201220 >>> await client.hpexpiretime("my_hash", ["field1", "field2", "non_existent_field"])
12211221 [future_timestamp_ms, future_timestamp_ms, -2] # field1 and field2 expire at future_timestamp_ms, non_existent_field doesn't exist
12221222
@@ -1249,17 +1249,17 @@ async def hsetex(
12491249 - ONLY_IF_ALL_EXIST (FXX): Only set fields if all of them already exist.
12501250 - ONLY_IF_NONE_EXIST (FNX): Only set fields if none of them already exist.
12511251 expiry (Optional[ExpirySet]): Expiration options for the fields:
1252- - EX : Expiration time in seconds.
1253- - PX : Expiration time in milliseconds.
1254- - EXAT: Absolute expiration time in seconds (Unix timestamp).
1255- - PXAT: Absolute expiration time in milliseconds (Unix timestamp).
1256- - KEEPTTL: Retain existing TTL.
1252+ - SEC (EX) : Expiration time in seconds.
1253+ - MILLSEC (PX) : Expiration time in milliseconds.
1254+ - UNIX_SEC ( EXAT) : Absolute expiration time in seconds (Unix timestamp).
1255+ - UNIX_MILLSEC ( PXAT) : Absolute expiration time in milliseconds (Unix timestamp).
1256+ - KEEP_TTL ( KEEPTTL) : Retain existing TTL.
12571257
12581258 Returns:
12591259 int: 1 if all fields were set successfully, 0 if none were set due to conditional constraints.
12601260
12611261 Examples:
1262- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.EX , 10))
1262+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.SEC , 10))
12631263 1 # All fields set with 10 second expiration
12641264 >>> await client.hsetex("my_hash", {"field3": "value3"}, field_conditional_change=HashFieldConditionalChange.ONLY_IF_ALL_EXIST)
12651265 1 # Field set because field already exists
@@ -1305,10 +1305,10 @@ async def hgetex(
13051305 key (TEncodable): The key of the hash.
13061306 fields (List[TEncodable]): The list of fields to retrieve from the hash.
13071307 expiry (Optional[ExpiryGetEx]): Expiration options for the retrieved fields:
1308- - EX : Expiration time in seconds.
1309- - PX : Expiration time in milliseconds.
1310- - EXAT: Absolute expiration time in seconds (Unix timestamp).
1311- - PXAT: Absolute expiration time in milliseconds (Unix timestamp).
1308+ - SEC (EX) : Expiration time in seconds.
1309+ - MILLSEC (PX) : Expiration time in milliseconds.
1310+ - UNIX_SEC ( EXAT) : Absolute expiration time in seconds (Unix timestamp).
1311+ - UNIX_MILLSEC ( PXAT) : Absolute expiration time in milliseconds (Unix timestamp).
13121312 - PERSIST: Remove expiration from the fields.
13131313
13141314 Returns:
@@ -1317,10 +1317,10 @@ async def hgetex(
13171317 If `key` does not exist, it is treated as an empty hash, and the function returns a list of null values.
13181318
13191319 Examples:
1320- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.EX , 10))
1320+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.SEC , 10))
13211321 >>> await client.hgetex("my_hash", ["field1", "field2"])
13221322 [b"value1", b"value2"]
1323- >>> await client.hgetex("my_hash", ["field1"], expiry=ExpiryGetEx(ExpiryTypeGetEx.EX , 20))
1323+ >>> await client.hgetex("my_hash", ["field1"], expiry=ExpiryGetEx(ExpiryTypeGetEx.SEC , 20))
13241324 [b"value1"] # field1 now has 20 second expiration
13251325 >>> await client.hgetex("my_hash", ["field1"], expiry=ExpiryGetEx(ExpiryTypeGetEx.PERSIST, None))
13261326 [b"value1"] # field1 expiration removed
@@ -1374,7 +1374,7 @@ async def hexpire(
13741374 - `2`: Field was deleted immediately (when seconds is 0 or timestamp is in the past).
13751375
13761376 Examples:
1377- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.EX , 10))
1377+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.SEC , 10))
13781378 >>> await client.hexpire("my_hash", 20, ["field1", "field2"])
13791379 [1, 1] # Both fields' expiration set to 20 seconds
13801380 >>> await client.hexpire("my_hash", 30, ["field1"], option=ExpireOptions.NewExpiryGreaterThanCurrent)
@@ -1420,7 +1420,7 @@ async def hpersist(self, key: TEncodable, fields: List[TEncodable]) -> List[int]
14201420 - `-2`: Field does not exist or key does not exist.
14211421
14221422 Examples:
1423- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.EX , 10))
1423+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.SEC , 10))
14241424 >>> await client.hpersist("my_hash", ["field1", "field2"])
14251425 [1, 1] # Both fields made persistent
14261426 >>> await client.hpersist("my_hash", ["field1"])
@@ -1467,7 +1467,7 @@ async def hpexpire(
14671467 - `2`: Field was deleted immediately (when milliseconds is 0 or timestamp is in the past).
14681468
14691469 Examples:
1470- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.PX , 10000))
1470+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.MILLSEC , 10000))
14711471 >>> await client.hpexpire("my_hash", 20000, ["field1", "field2"])
14721472 [1, 1] # Both fields' expiration set to 20000 milliseconds
14731473 >>> await client.hpexpire("my_hash", 30000, ["field1"], option=ExpireOptions.NewExpiryGreaterThanCurrent)
@@ -1528,7 +1528,7 @@ async def hexpireat(
15281528 Examples:
15291529 >>> import time
15301530 >>> future_timestamp = int(time.time()) + 60 # 60 seconds from now
1531- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.EX , 10))
1531+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.SEC , 10))
15321532 >>> await client.hexpireat("my_hash", future_timestamp, ["field1", "field2"])
15331533 [1, 1] # Both fields' expiration set to future_timestamp
15341534 >>> past_timestamp = int(time.time()) - 60 # 60 seconds ago
@@ -1588,7 +1588,7 @@ async def hpexpireat(
15881588 Examples:
15891589 >>> import time
15901590 >>> future_timestamp_ms = int(time.time() * 1000) + 60000 # 60 seconds from now in milliseconds
1591- >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.PX , 10000))
1591+ >>> await client.hsetex("my_hash", {"field1": "value1", "field2": "value2"}, expiry=ExpirySet(ExpiryType.MILLSEC , 10000))
15921592 >>> await client.hpexpireat("my_hash", future_timestamp_ms, ["field1", "field2"])
15931593 [1, 1] # Both fields' expiration set to future_timestamp_ms
15941594 >>> past_timestamp_ms = int(time.time() * 1000) - 60000 # 60 seconds ago in milliseconds
0 commit comments