LdapTools\Factory\CacheFactory::get PHP Метод

get() публичный статический Метод

Retrieve the Cache object by its configured type and options.
public static get ( $type, array $options ) : LdapTools\Cache\CacheInterface
$type
$options array
Результат LdapTools\Cache\CacheInterface
    public static function get($type, array $options)
    {
        if (self::TYPE_STASH == $type) {
            $cache = new StashCache();
        } elseif (self::TYPE_DOCTRINE == $type) {
            $cache = new DoctrineCache();
        } elseif (self::TYPE_NONE == $type) {
            $cache = new NoCache();
        } else {
            throw new InvalidArgumentException(sprintf('Unknown cache type "%s".', $type));
        }
        $cache->setOptions($options);
        return $cache;
    }

Usage Example

Пример #1
0
 /**
  * @param LdapConnectionInterface $connection
  * @param EventDispatcherInterface $dispatcher
  */
 public function __construct(LdapConnectionInterface $connection, EventDispatcherInterface $dispatcher)
 {
     $this->connection = $connection;
     $this->dispatcher = $dispatcher;
     $cache = CacheFactory::get(CacheFactory::TYPE_NONE, []);
     $parser = SchemaParserFactory::get(SchemaParserFactory::TYPE_YML, self::SCHEMA_DIR);
     $this->schemaFactory = new LdapObjectSchemaFactory($cache, $parser, $dispatcher);
 }
All Usage Examples Of LdapTools\Factory\CacheFactory::get
CacheFactory