Welcome Guest, Not a member yet? Register   Sign In
CI Redis cache driver
#1

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
Reply
#2

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

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

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.
Reply
#5

that is just great
Reply
#6

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

(This post was last modified: 09-09-2016, 06:59 PM by Diederik.)

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.
Reply
#8

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
Reply
#9

(This post was last modified: 09-10-2016, 07:30 AM by arma7x.)

(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.
Keep calm.
Reply
#10

(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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB