@@ -1034,7 +1034,8 @@ def renamenx(self, src, dst):
1034
1034
"Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist"
1035
1035
return self .execute_command ('RENAMENX' , src , dst )
1036
1036
1037
- def restore (self , name , ttl , value , replace = False , absttl = False ):
1037
+ def restore (self , name , ttl , value , replace = False , absttl = False ,
1038
+ idletime = None , frequency = None ):
1038
1039
"""
1039
1040
Create a key using the provided serialized value, previously obtained
1040
1041
using DUMP.
@@ -1045,12 +1046,32 @@ def restore(self, name, ttl, value, replace=False, absttl=False):
1045
1046
``absttl`` if True, specified ``ttl`` should represent an absolute Unix
1046
1047
timestamp in milliseconds in which the key will expire. (Redis 5.0 or
1047
1048
greater).
1049
+
1050
+ ``idletime`` Used for eviction, this is the number of seconds the
1051
+ key must be idle, prior to execution.
1052
+
1053
+ ``frequency`` Used for eviction, this is the frequency counter of
1054
+ the object stored at the key, prior to execution.
1048
1055
"""
1049
1056
params = [name , ttl , value ]
1050
1057
if replace :
1051
1058
params .append ('REPLACE' )
1052
1059
if absttl :
1053
1060
params .append ('ABSTTL' )
1061
+ if idletime is not None :
1062
+ params .append ('IDLETIME' )
1063
+ try :
1064
+ params .append (int (idletime ))
1065
+ except ValueError :
1066
+ raise DataError ("idletimemust be an integer" )
1067
+
1068
+ if frequency is not None :
1069
+ params .append ('FREQ' )
1070
+ try :
1071
+ params .append (int (frequency ))
1072
+ except ValueError :
1073
+ raise DataError ("frequency must be an integer" )
1074
+
1054
1075
return self .execute_command ('RESTORE' , * params )
1055
1076
1056
1077
def set (self , name , value ,
@@ -3084,6 +3105,7 @@ def _geosearchgeneric(self, command, *args, **kwargs):
3084
3105
def module_load (self , path , * args ):
3085
3106
"""
3086
3107
Loads the module from ``path``.
3108
+ Passes all ``*args`` to the module, during loading.
3087
3109
Raises ``ModuleError`` if a module is not found at ``path``.
3088
3110
"""
3089
3111
pieces = list (args )
0 commit comments