title: How to extend Code igniter cache class Redis class
body: <p>I am using redis for caching in one of my assignment. I am using CI default redis library for this purpose.</p>
  <p>Now the issue with library is that it has some specific set of method which are used to set, get, delete , increment and decrement the redis keys &amp; values.</p>
  <p>I want to additional function of redis like lpush, rpush,lrem, lrange etc.
  So to achieve this , i am trying to extend default CI redis class. which i am putting in application/libraries/driver/cache_redis_extended.php.
  my code for this class is as follow.</p>
  <pre><code>&lt;?php defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Cache_redis_extended extends CI_Cache_redis
  {
  
      function __construct()
      {
           parent::self;
      }
  
      public function rpush($list, $data)
      {
          $push = $this-&gt;_redis-&gt;multi(Redis::PIPELINE);      
          return $push-&gt;rpush($list, json_encode($data));
      }
      
      public function lrem($list, $data)
      {
          if((is_string($data) &amp;&amp; (is_object(json_decode($data)) ||      is_array(json_decode($data))))) {
              $data = $data;
          }else{
              json_encode($data);
          }
          return $this-&gt;_redis-&gt;lrem($list,-1, $data);
      }
  
      public function __destruct()
      {
          if ($this-&gt;_redis)
          {
              $this-&gt;_redis-&gt;close();
          }
      }
      
  }
  </code></pre>
  <p>and in my model I am loading this class as follows</p>
  <pre><code> $CI-&gt;load-&gt;driver('cache', array('adapter' =&gt; 'redis'));
  </code></pre>
  <p>But I get this error:</p>
  <p><strong>Unable to load the requested class: cache_redis_extended</strong></p>
  <p>Any help is appreciated for this issue.</p>