Skip to content

Multiget #16

Open
Open
@e120281

Description

@e120281

Hi Jeremy,

I thought it would be nice to be able to take advantage of memcached multiget functionality. In current implementation multiget (I give array of keys to get function) fails because of "$key = $this->prefix . $key;" line.

public function get($key)
{
    if ($this->isSafe()) {
        $key = $this->prefix . $key;
        return $this->mem->get($key);
    }

    return false;
}

Something like below should do the work, I guess. Please let me know what you think.

public function get($key)
{
    if ($this->isSafe()) {
        if (is_array($key)) {
            if ($this->prefix != '') {
                for ($i = 0; $i < count($key); $i++) {
                    $key[$i] = $this->prefix . $key[$i];
                }
            }
        }
        else {
            $key = $this->prefix . $key;
        }

        return $this->mem->get($key);
    }

    return false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions