Open
Description
Description
Give the python client access to the Redis command MEMORY USAGE by exposing it
through the Pybindings.
Justification
The user will be able to get the number of bytes that a key and its value
require to be stored in RAM. The user will be able to track their memory
usage better.
Implementation Strategy
MEMORY USAGE
will be a SingleKeyCommand
.
The implementation will look something like this in client.cpp
:
uint64_t Client::memory_usage(std::string key)
{
SingleKeyCommand cmd;
cmd->add_field("MEMORY");
cmd->add_field("USAGE");
cmd->add_field(key, true)
CommandReply reply = _run(cmd);
if (reply.has_error() > 0)
throw std::runtime_error("LATENCY RESET command failed");
return reply.integer();
}
This functionality then needs to be exposed through the Pybindings and pyclient.cpp
file to the python client layer.