Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow dispatching of unknown methods to redis connection object #654

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions storage/cache/adapter/Redis.php
Expand Up @@ -99,6 +99,27 @@ protected function _init() {
$this->connection->{$method}($ip, $port); $this->connection->{$method}($ip, $port);
} }


/**
* Dispatches a not-found method to the Redis connection object.
*
* That way, one can easily use a custom method on that redis adapter like that:
*
* {{{Cache::adapter('named-of-redis-config')->methodName($argument);}}}
*
* If you want to know, what methods are available, have a look at the readme of phprdis.
* One use-case might be to query possible keys, e.g.
*
* {{{Cache::adapter('redis')->keys('*');}}}
*
* @link https://github.com/nicolasff/phpredis GitHub: PhpRedis Extension
* @param string $method Name of the method to call
* @param array $params Parameter list to use when calling $method
* @return mixed Returns the result of the method call
*/
public function __call($method, $params = array()) {
return call_user_func_array(array(&$this->connection, $method), $params);
}

/** /**
* Sets expiration time for cache keys * Sets expiration time for cache keys
* *
Expand Down