Example #1
0
 /**
  * Instantiates the class
  *
  * @author Art <*****@*****.**>
  *
  * @param boolean $initDefaultServer Whether to add a server on construct
  */
 function __construct($initDefaultServer = true)
 {
     $this->client = new Redis();
     if ($initDefaultServer) {
         $this->addServer();
     }
     parent::__construct();
     \Log::debug('RedisWrapper instantiated.');
 }
 /**
  * Instantiates the class
  *
  * @author Art <*****@*****.**>
  *
  * @param boolean $initDefaultServer Whether to add a server on construct
  */
 function __construct($initDefaultServer = true)
 {
     if (self::$loaded === null) {
         if (class_exists('\\Memcached', false)) {
             self::$loaded = self::CLASS_MEMCACHED;
         } elseif (class_exists('\\Memcache')) {
             self::$loaded = self::CLASS_MEMCACHE;
         } else {
             self::$loaded = false;
         }
     }
     if (self::$loaded !== null) {
         $this->client = self::$loaded === self::CLASS_MEMCACHED ? new Memcached() : new Memcache();
         if ($initDefaultServer) {
             $this->addServer();
         }
     } else {
         phpWarning('Memcached extension not loaded - caching ' . 'functions will not work');
     }
     parent::__construct();
     \Log::debug(self::$loaded ? 'Loaded MemcachedWrapper' : 'MemcachedWrapper not loaded: extension unavailable');
 }