BTW, Gustavo, do you remember you have a RedisCache extension. It is based on Predis. Yesterday I wrote a RedisCache based on phpredis. Most of the code is referred from your extension and CMemCache. I noticed one problem that in your RedisCache, you implemented offsetExists(). Since CCache::set() actually pass the hashed key (generateUniqueKey()) to setValue(), how do you make offsetExists() work without wrapping generateUniqueKey() inside? Do you expect caller generate hashed key before calling offsetExists()?
public function offsetExists($id)
but not require us to override it
CCache::offsetSet() forwards parameters to CCache::set(). Even if user calls offsetSet() then offsetExists(), he/she won’t get expected result. What’s the logic behind the offset series functions?
predis vs phpredis? I guess you can find many different answers over Google/Stack Overflow. In my mind, performance and functionality are the main advantages. This post is resourceful (phpredis author is also in discussion).
Since you implement __call(), I would prefer to stick with one coding style by using get(), set(), exists().
Which part of phpredis is not consistent with Redis? The pipelining part? I’m very new to Redis, therefore I’m not sure if I would rely on the features that are inconsistent. According to their benchmark, 2-3 times gain on performance is not simply ignorable.
I just want to point out that https://github.com/nicolasff/phpredis is phpredis homepage (linked by redis.io). There is del(). There is mset(). There is hMGet(). There is no mget() but instead getMultiple(). Could "mget" reserved by PHP or something?
Also, can you explain a little bit about the generateUniqueKey() and keyPrefix? Isn’t the users responsible to make keys unique (if they are meant to be unique)?