• How to use Redis Cache in Opencart

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

How to use Redis with Opencart?

In order to use Redis with Opencart, you need to make some changes to your Opencart system. You have to edit /system/config/default.php and change the value of $_[‘cache_type’].

$_['cache_engine'] = 'redis';

You also need to define several constants. You can make changes in both /config.php and /admin/config.php or you can perform changes in either /system/startup.php or /system/framework.php (before cache object in this case). You have to define following constants.

define('CACHE_HOSTNAME', '');
define('CACHE_PORT', '6379');
define('CACHE_PREFIX', 'redis_');

Now, you are complete with the changes in Opencart and you can make use of Redis on your website.

This article was last modified: Jan. 21, 2019, 11:08 a.m.


Please log in to leave a comment.

Add or change tags.

A comma-separated list of tags.


Hacker News