LdapTools\Configuration::setCacheType PHP Method

setCacheType() public method

Set the cache type to use.
public setCacheType ( $type )
$type
    public function setCacheType($type)
    {
        if (!defined('\\LdapTools\\Factory\\CacheFactory::TYPE_' . strtoupper($type))) {
            throw new ConfigurationException(sprintf('Unknown cache type "%s".', $type));
        }
        $this->config['cacheType'] = $type;
        return $this;
    }

Usage Example

 public function let(LdapConnectionInterface $connection)
 {
     $config = new Configuration();
     $config->setCacheType('none');
     $connection->execute(Argument::any())->willReturn($this->ldapEntries);
     $connection->getConfig()->willReturn(new DomainConfiguration('example.local'));
     $cache = CacheFactory::get($config->getCacheType(), $config->getCacheOptions());
     $parser = SchemaParserFactory::get($config->getSchemaFormat(), $config->getSchemaFolder());
     $dispatcher = new SymfonyEventDispatcher();
     $schemaFactory = new LdapObjectSchemaFactory($cache, $parser, $dispatcher);
     $this->beConstructedWith($schemaFactory->get('ad', 'user'), $connection);
 }
All Usage Examples Of LdapTools\Configuration::setCacheType