Exemplo n.º 1
0
 /**
  * Initializes cache. Defaults to Array cache.
  *
  * @return \Doctrine\Common\Cache\CacheProvider
  * @throws \Exception
  * @throws \Symfony\Component\Debug\Exception\ClassNotFoundException
  */
 protected function createCache()
 {
     if (is_null(config('doctrine.cache.provider'))) {
         return null;
     }
     $cacheProvider = config('doctrine.cache.provider');
     $supportedProviders = config('doctrine.cache.providers', []);
     $cacheConfiguration = config('doctrine.cache.' . $cacheProvider);
     $namespace = config('doctrine.cache.namespace', config('cache.prefix'));
     CacheFactory::setProviders($supportedProviders);
     return CacheFactory::getCacheProvider($cacheProvider, $cacheConfiguration, $namespace);
 }
 function it_should_return_memcached_provider()
 {
     \Atrauzzi\LaravelDoctrine\CacheFactory::setProviders(['memcached' => 'Atrauzzi\\LaravelDoctrine\\CacheProvider\\MemcachedProvider']);
     $this->beConstructedThrough('getCacheProvider', ['memcached', ['host' => '127.0.0.1', 'port' => '11211']]);
     $this->shouldHaveType('Doctrine\\Common\\Cache\\MemcachedCache');
 }