Welcome Guest, Not a member yet? Register   Sign In
Extending redis library
#1

(This post was last modified: 10-05-2019, 07:09 AM by fabby.)

I tried extending the redis library without any success.

Error: Severity: error --> Exception: Class 'CI_Cache_redis' not found /var/www/vhosts/***.net/***.net/application/libraries/MY_redis.php 5

Redis library is loaded and functional, just extending seems not possible.

PHP Code:
<?php

 defined
('BASEPATH') OR exit('No direct script access allowed');

class 
MY_redis extends CI_Cache_redis {
    function __construct(){
         parent::self;
    }

    public function publish($channel$message) {
        $this->_redis->publish($channel$message);
    }

    public function __destruct() {
        if ($this->_redis) {
            $this->_redis->close();
        }
    }

Reply
#2

Out of the box, database classes can not be extended or replaced with your own classes as all other classes can. In other words, the MY_ convention does not apply to the database files.

I think you would have to extend the CI_Loader class and/or register an autoloader that can locate db driver files.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB