Skip to content

Expose MEMORY USAGE to the python client #119

Open
@ctandon11

Description

@ctandon11

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: pythonIssues related to the Python Clienttype: featureIssues that include feature request or feature idea

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions