Post by akvriksha15 » Tue Jul 25, 2017 6:40 am

Hi,
There is a Redis cache driver in Opencart 2.3
system/library/cache/redis.php

<?php
namespace Cache;
class Redis {
private $expire;
private $cache;
public function __construct($expire) {
$this->expire = $expire;
$this->cache = new \Redis();
$this->cache->pconnect(CACHE_HOSTNAME, CACHE_PORT);
}
public function get($key) {
$data = $this->cache->get(CACHE_PREFIX . $key);
return json_decode($data, true);
}
public function set($key,$value) {
$status = $this->cache->set(CACHE_PREFIX . $key,
json_encode($value));
if($status){
$this->cache->setTimeout(CACHE_PREFIX . $key, $this->expire);
}
return $status;
}
public function delete($key) {
$this->cache->delete(CACHE_PREFIX . $key);
}
}



I putted the following in /config.php

// CACHE
define('CACHE_DRIVER', 'redis');
define('REDIS_HOSTNAME', 'localhost');
define('REDIS_PORT', '6379');
define('CACHE_PREFIX', 'oc_');

it's showing error

Fatal error: Uncaught Error: Class 'Redis' not found in /system/library/cache/redis.php:8 Stack trace: #0 /system/library/cache.php(9): Cache\Redis->__construct(3600) #1 /system/framework.php(49): Cache->__construct('redis', 3600) #2 /system/startup.php(124): require_once('/home/system/...') #3 /public_html/index.php(19): start('catalog') #4 {main} thrown in /system/library/cache/redis.php on line 8


Any idea what's wrong ? :bash: Redis is already installed on server and its running fine.

Newbie

Posts

Joined
Wed Mar 19, 2014 4:12 am

Post by daveyoi » Tue Jul 25, 2017 4:50 pm

There is not much detail in the commit that added this cache, but looking at the code I would assume you need the Predis PHP extension installed to make this work.

https://github.com/phpredis/phpredis

Image
Tristar Web Solutions


New member

Posts

Joined
Sun Oct 05, 2014 2:38 am

Post by akvriksha15 » Tue Jul 25, 2017 5:15 pm

I see the same redis file is here : https://github.com/opencart/opencart/co ... ba33117a72

Also one thing I forgot to mention after changing the /config.php changed the cache driver in / System / config / default.php
// Cache
$_['cache_type'] = 'redis'; // apc, file or mem
$_['cache_expire'] = 3600;}

But the error is same

Newbie

Posts

Joined
Wed Mar 19, 2014 4:12 am

Post by akvriksha15 » Tue Jul 25, 2017 5:31 pm

daveyoi wrote:
Tue Jul 25, 2017 4:50 pm
There is not much detail in the commit that added this cache, but looking at the code I would assume you need the Predis PHP extension installed to make this work.

https://github.com/phpredis/phpredis
Hi,
PHP redis is already installed as i said earlier redis is working fine on the server

Newbie

Posts

Joined
Wed Mar 19, 2014 4:12 am

Post by akvriksha15 » Thu Jul 27, 2017 5:23 am

Any Help ?

Newbie

Posts

Joined
Wed Mar 19, 2014 4:12 am

Post by amclub » Sat Sep 09, 2017 4:17 pm

I also want to know it.
Anybody had installed redis and work fine in opencart version 2.3.0.2?

Newbie

Posts

Joined
Wed Apr 05, 2017 10:35 pm

Post by webcorvo » Thu Sep 14, 2017 6:51 pm

amclub wrote:
Sat Sep 09, 2017 4:17 pm
I also want to know it.
Anybody had installed redis and work fine in opencart version 2.3.0.2?
Yes version 2.3.0.2 works fine

Opencart Developer - For custom work and support contact @ webcorvo@gmail.com


User avatar
Active Member

Posts

Joined
Mon Mar 20, 2017 11:42 pm
Location - Lisbon, Portugal

Post by dic76 » Sun Nov 21, 2021 2:45 pm

Hi, i want uninstall or deactivate redis in my website. How to?

Newbie

Posts

Joined
Mon Oct 04, 2021 11:26 pm
Who is online

Users browsing this forum: No registered users and 285 guests