>警法>>正文

Using Redis Cache In our website

原标题:Using Redis Cache In our website

Nowadays, caching has become a hot topic of discussion as everyone wants to maintain their website’s speed even on handling millions of users at a time. Opencart is using caching since its initial days like used file cache in version 1.5, then added APC (Alternative PHP Cache) and Memcache in version 2 and now in version 3 added Redis library.

Redis Introduction

Redis has its own advantages. According to its website, 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 ing, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

Redis is an in-memory data structure server. You can add any values to Redis cache like integers, string etc.

How to use Redis with Opencart?

In order to use Redis with Opencart, you have to first install Redis to your server. Here is the Download Link.

Then you have to install phpredis to your server.

You can check Redis in phpinfo().

Now, you have to make some changes to your opencart system. You have to edit system->config->default.php and change the value of $_[‘cache_type’].

1

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

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

1

2

3

define('CACHE_HOSTNAME', '127.0.0.1');

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.返回搜狐,查看更多

责任编辑:

声明:该文观点仅代表作者本人,搜狐号系信息发布平台,搜狐仅提供信息存储空间服务。
阅读 ()
投诉
免费获取
今日搜狐热点
今日推荐