Created
September 21, 2019 14:41
-
-
Save 1fabiopereira/3d5d53e780e61ce48afdf82fe014d9ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (redis) => { | |
const cmds = [ | |
// O(N), where N is the size of the deleted value. | |
'json.del', | |
// O(N), where N is the size of the value. | |
'json.get', | |
// O(M*N), where M is the number of keys and N is the size of the value. | |
'json.mget', | |
// O(M+N), where M is the size of the original value (if it exists) and N is the size of the new value. | |
'json.set', | |
// O(1). | |
'json.type', | |
// O(1). | |
'json.numincrby', | |
// O(1). | |
'json.nummultby', | |
// O(N), where N is the new string's length. | |
'json.strappend', | |
// O(1). | |
'json.strlen', | |
// O(1). | |
'json.arrappend', | |
// O(N), where N is the array's size. | |
'json.arrindex', | |
// O(N), where N is the array's size. | |
'json.arrinsert', | |
// O(1). | |
'json.arrlen', | |
// O(N), where N is the array's size for index other than the last element, O(1) otherwise. | |
'json.arrpop', | |
// O(N), where N is the array's size. | |
'json.arrtrim', | |
// O(N), where N is the number of keys in the object. | |
'json.objkeys', | |
// O(1). | |
'json.objlen', | |
// O(N), where N is the size of the JSON value. | |
'json.debug', | |
// An alias for JSON.DEL. | |
'json.forget', | |
// O(N), where N is the size of the JSON value. | |
'json.resp' | |
] | |
cmds.forEach((cmd) => redis.addCommand(cmd)) | |
return redis | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment