true, 'cacheDir' => $config_vars['cache']['dir'] . DIRECTORY_SEPARATOR, 'lifeTime' => 86400, //One day, cache should be cleared when the data is modified 'fileLocking' => true, 'writeControl' => true, 'readControl' => true, 'memoryCaching' => false, 'onlyMemoryCaching' => false, 'automaticSerialization' => true, //'hashedDirectoryLevel' => 1, 'fileNameProtection' => false, 'redisHost' => ( isset( $config_vars['cache']['redis_host'] ) ) ? $config_vars['cache']['redis_host'] : '', 'redisDB' => ( isset( $config_vars['cache']['redis_db'] ) ) ? $config_vars['cache']['redis_db'] : '', ]; if ( isset( $config_vars['cache']['redis_host'] ) && $config_vars['cache']['redis_host'] != '' ) { //To reduce the number of connections to REDIS, share the same connection across all SharedMemory instances. // Both ProgressBar and RateLimit classes instantiate SharedMemory. global $tt_shared_memory_obj; if ( is_object( $tt_shared_memory_obj ) ) { $this->obj = $tt_shared_memory_obj; } else { $split_server = explode( ',', $config_vars['cache']['redis_host'] ); $cache_options['redisHost'] = $split_server[0]; //Use just the master server, as shared memory doesn't need to span servers. require_once( Environment::getBasePath() . 'classes' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'other' . DIRECTORY_SEPARATOR . 'Redis_Cache_Lite.class.php' ); $tt_shared_memory_obj = $this->obj = new Redis_Cache_Lite( $cache_options ); } } else { $this->obj = new Cache_Lite( $cache_options ); } return true; } /** * @param $key * @param $value * @return bool */ function set( $key, $value ) { if ( is_string( $key ) ) { return $this->obj->save( $value, $key, 'sharedmemory' ); } return false; } /** * @param $key * @return bool */ function get( $key ) { if ( is_string( $key ) ) { return $this->obj->get( $key, 'sharedmemory' ); } return false; } /** * @param $key * @return bool */ function delete( $key ) { if ( is_string( $key ) ) { return $this->obj->remove( $key, 'sharedmemory' ); } return false; } } ?>