Author: Chad Sikorra (Chad.Sikorra@gmail.com)
Inheritance: implements LdapTools\Cache\CacheInterface
Beispiel #1
0
 /**
  * Retrieve the Cache object by its configured type and options.
  *
  * @param $type
  * @param array $options
  * @return 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;
 }