Provides object oriented access to Redis in a familiar Yii Style. When you add or remove items from redis entities (lists, sets, sorted sets, hashes), changes are pushed to the server immediately, this is useful when your application needs to make information available across multiple requests.
This package relies on the https://github.com/nicolasff/phpredis PHP extension, please make sure this is installed before continuing.
Please see the github project page for usage examples.
Total 8 comments
WORKS if I modify ARedisCache flush():
public function flush() { return (bool) $this->getConnection()->getClient()->flushAll(); }If you have a password-protected Redis server you can add the following property to ARedisConnection:
And change getClient method from
if ($this->_client === null) { $this->_client = new Redis; $this->_client->connect($this->hostname, $this->port); } return $this->_client;to
if ($this->_client === null) { $this->_client = new Redis; $this->_client->connect($this->hostname, $this->port); $this->_client->auth($this->authString); } return $this->_client;It would be nice if you could add this to your release!
Thanks much for the quick reply, my oversight, works a treat with Phpredis. I assume the flush issue wont' affect using it for Yii session management. I do wonder if using flushdb would be one way to get that to work -- obviously would assume that the db is used exclusively for cache.
This extension depends on phpredis, it may partly work with predis but its not supported. Flushing the cache is not currently supported, I will look into it
This looks great but I have a couple questions about setting up the environment - I have Predis (0.7.1) running and it works fine - when I load your extension
In order to avoid a "Redis.php - No such file", I needed to change the client connection from:
$this->_client = new Redis;
to:
$this->_client = new Predis\Client();
There are a couple other issues as well, like I needed to change your "delete" command to "del", and similarly I get "'flush' is not a registered Redis command" when trying to clear/flush the cache -- is that supposed to be flushdb or am I doing something wrong?
Also, Gustavo, is there any benefit to using this over your extension for Yii cache at this point?
Thanks much.
This will save a lot of work. Thanks!
Greetings,
Hannes
Wow... php redis its really something new for me. Thx and its really good for tuning all of my yii apps.. lets see how fast and how it works...
I've been meaning to do something like this for a while, but never found the time !
Cheers, Gustavo
Leave a comment
Please login to leave your comment.