Jump to content

Redis Databases


Recommended Posts

You have to create a second parameter in the global.inc.php file and @Al Brookbanks has updated the caching documentation (although that page talks about "redis_options" and I believe that this should be "redis_params")

https://support.cubecart.com/Knowledgebase/Article/View/235/41/how-do-i-enable-apc-memcached-or-xcache

So for example you can pass one or more parameters via redis_params and any not passed will use the default

$glob['cache'] = 'redis';
$glob['redis_params']=array('parameters' => array('database' => 1));

Ian

Link to comment
Share on other sites

Ian your version is out of date. Please see:

https://support.cubecart.com/Knowledgebase/Article/View/235/41/how-do-i-enable-apc-memcached-redis-or-xcache

This relates to:

https://github.com/cubecart/v6/blob/master/classes/cache/redis.class.php#L32-L38

$glob['redis_params'] is not valid.

I noticed yesterday on my dev store that the payment options don't show with Redis so we may have a bug somewhere. Not seen any other issues though. Personally I don't like it at all and I don't think Redis is suitable for storing the types of data CubeCart needs it to. These are predominantly objects and arrays. The PHP serialize function to get around this is poor and unreliable. 

Link to comment
Share on other sites

Hadnt gone back to testing since the original version and while I saw you were supporting Sentinal, hadnt noticed the change to the params / options parameter !  Good job only on a few test sites so far then !

The problem is that "files" method is significantly slower so an in memory based method should always be used. APC and Xcache are effectively dead and while many people are still using memcache, the memcache and memcached libraries havent been updated in four / five years. Redis is actively developed and has a huge number of features that none of the other options have ever had.

Redis is widely considered to be much superior to Memcache and is the recommended option for all Magento sites (although Full Page and Session Cache options in addition are also available making it even more attractive) and Magento isnt that different ? 

Link to comment
Share on other sites

I'm still new to Redis. CubeCart needs to mainly store objects and arrays which Redis isn't geared up to taking. I don't know how other systems use it but I expect we need to manipulate the data prior to store rather than using the PHP serialize funciton to save it as a string. 

This cache system is very new and still WIP. 

Storing arrays in Redis:

http://stackoverflow.com/questions/22718903/storing-an-array-of-data-using-redis-from-laravel
http://stackoverflow.com/questions/22001247/redis-how-to-store-associative-array-set-or-hash-or-list
http://stackoverflow.com/questions/38747339/how-to-store-array-of-objects-in-redis

I don't think any of those solutions are very good. 

Link to comment
Share on other sites

I developed the integration with redis installed locally with default config which I didn't even look at. I did know that they could be changed in the class constructor so I added the ability to add these settings via the global file. 

Looks like you are on the right lines. 

Link to comment
Share on other sites

On 10/28/2016 at 8:36 AM, bondimedical said:

I have just started using it and configured it to use database 10 with:

$glob['redis_options'] = array('parameters' => array('database' => 10));

But I don't see any keys in the database?

I agree - there looks like a problem with the implementation of redis as all keys are being stored in DB0 regardless of what is specified in the redis_options parameter.  I will work with Al to try and get this fixed

Link to comment
Share on other sites

  • 4 weeks later...

I can confirm that this is now working using the latest redis cache class file and once it is configured correctly.  Tested with three different CubeCart installations on one server each having their own database defined - now just to get session and full page cache methods implemented and this will be a far, far superior caching method than anything else

Link to comment
Share on other sites

  • 4 years later...

Redis databases are numbered from 0 to 15 and, by default, you connect to database 0 when you connect to your Redis instance. Also, I was having some problem when I install php redis in custom php websites. Thanks to the blog mentioned, it really does assist me.

Edited by Wiyokar
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...