CodeIgniter Forums
CI Redis cache driver - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: CI Redis cache driver (/showthread.php?tid=65956)



CI Redis cache driver - consigliere - 08-16-2016

Hi, 

In CI version 3.x we have Redis support.
Official documentation for 'more information' points to https://github.com/phpredis/phpredis
But if I user for example:

Code:
$this->cache->redis->hSet('h', 'key1', 'hello');
Error: 

Type:        BadMethodCallException
Message:     No such method: hSet()

Also in system\libraries\Cache\drivers\Cache_redis.php 
We have ony save, get, delete, increment, decrement, clean, cache_info, get_metadata

How I can use this?
What to do?

Thanks


RE: CI Redis cache driver - Narf - 08-16-2016

It's more information on what's used in the CI implementation, not a list of additional methods.


RE: CI Redis cache driver - consigliere - 08-17-2016

And why we do not have additional methods?
What's the point to disable hmaps in redis in CI library? :S


RE: CI Redis cache driver - Narf - 08-17-2016

The Cache library is an abstraction ... it provides a common, often easier to use interface to its underlying drivers. It doesn't "disable" methods like you're saying.

If you want to, and know that you will only use Redis, then use phpRedis directly.


RE: CI Redis cache driver - consigliere - 08-19-2016

that is just great


RE: CI Redis cache driver - consigliere - 09-09-2016

and will be added more functionality to redis library in the future?


RE: CI Redis cache driver - Diederik - 09-09-2016

No, it is not a redis library it is a cache library. The whole point here is that it provides a wrapper for common functions that exists in all the supported cache systems. This allows you to switch from redis to memcache etc by only changing your config file. It makes no sense to provide functions for a specific system in an abstraction layer like Narf said.

If you want / need redis specific functions you need to use the official phpredis class. This should give you no troubles unless you need to switch from redis to another cache system, then you will need to do some rewriting in your code.


RE: CI Redis cache driver - consigliere - 09-10-2016

that is stupid... and probably the reason why CI is losing developers
if you are doing something do it all the way and not just half way


RE: CI Redis cache driver - arma7x - 09-10-2016

(09-10-2016, 05:40 AM)consigliere Wrote: that is stupid... and probably the reason why CI is losing developers
if you are doing something do it all the way and not just half way

Then stop use CI, simple right.


RE: CI Redis cache driver - Diederik - 09-10-2016

(09-10-2016, 05:40 AM)consigliere Wrote: that is stupid... and probably the reason why CI is losing developers
if you are doing something do it all the way and not just half way

I'm sorry you cannot grasp the concept of a generalized abstraction layer. That has absolutely nothing to do with CI or it's popularity.

Why would you expect CI to wrIteie a complete wrapper for Redis when phpredis can do that job perfectly? Again, you can include phpredis in just q handfull of lines of code in CI, or any other framework if you like. You are not bound to the CI cache implementation.