public function setCacheProvider($provider = null, $config = array()) {
    if ($provider) {
      switch ($provider) {
        case 'inmemory':
          $this->cache = new ArrayCache();
          break;
        case 'redis':
          if (!isset($config['host'])) {
            throw new GiantBombException('host config not specified');
          }
          if (!isset($config['port'])) {
            throw new GiantBombException('port config not specified');
          }
          $redis = new Redis();
          $redis->connect($config['host'], $config['port']);

          $this->cache = new RedisCache();
          $this->cache->setRedis($redis);
          break;
        default:
          throw new GiantBombException('Unsupported cache type: ' . $provider);
      };
    }
  }
public function setCacheProvider($provider = null, $config = array()) {
    if ($provider) {
      switch ($provider) {
        case 'inmemory':
          $this->cache = new ArrayCache();
          break;
        case 'redis':
          if (!isset($config['host'])) {
            throw new GiantBombException('host config not specified');
          }
          if (!isset($config['port'])) {
            throw new GiantBombException('port config not specified');
          }
          $redis = new Redis();
          $redis->connect($config['host'], $config['port']);

          $this->cache = new RedisCache();
          $this->cache->setRedis($redis);
          break;
        default:
          throw new GiantBombException('Unsupported cache type: ' . $provider);
      };
    }
  }
public function setCacheProvider ( $ provider = null , $ config = array ( ) ) { if ( $ provider ) { switch ( $ provider ) { case 'inmemory' : $ this -> cache = new ArrayCache ( ) ; break ; case 'redis' : if ( ! isset ( $ config [ 'host' ] ) ) { throw new GiantBombException ( 'host config not specified' ) ; } if ( ! isset ( $ config [ 'port' ] ) ) { throw new GiantBombException ( 'port config not specified' ) ; } $ redis = new Redis ( ) ; $ redis -> connect ( $ config [ 'host' ] , $ config [ 'port' ] ) ; $ this -> cache = new RedisCache ( ) ; $ this -> cache -> setRedis ( $ redis ) ; break ; default : throw new GiantBombException ( 'Unsupported cache type: ' . $ provider ) ; } ; } }
Set type of cache to use

@param $provider string supported values: inmemory, redis
@param $config   optional config required for cache type, eg: connection details for redis

@return array response of API
Set type of cache to use