Author: Piotr Stankowski (git@trakos.pl)
Author: Nicolas Grekas (p@tchwork.com)
Inheritance: extends Symfony\Component\Cache\Adapter\AbstractAdapter, use trait Symfony\Component\Cache\Adapter\FilesystemAdapterTrait
Example #1
0
 public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null)
 {
     if (null === self::$apcuSupported) {
         self::$apcuSupported = ApcuAdapter::isSupported();
     }
     if (!self::$apcuSupported && null === self::$phpFilesSupported) {
         self::$phpFilesSupported = PhpFilesAdapter::isSupported();
     }
     if (self::$phpFilesSupported) {
         $opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory);
         if (null !== $logger) {
             $opcache->setLogger($logger);
         }
         return $opcache;
     }
     $fs = new FilesystemAdapter($namespace, $defaultLifetime, $directory);
     if (null !== $logger) {
         $fs->setLogger($logger);
     }
     if (!self::$apcuSupported) {
         return $fs;
     }
     $apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version);
     if (null !== $logger) {
         $apcu->setLogger($logger);
     }
     return new ChainAdapter(array($apcu, $fs));
 }
Example #2
0
 public function createCachePool()
 {
     if (!PhpFilesAdapter::isSupported()) {
         $this->markTestSkipped('OPcache extension is not enabled.');
     }
     return new PhpFilesAdapter('sf-cache');
 }
 public function createCachePool()
 {
     if (defined('HHVM_VERSION')) {
         $this->skippedTests['testDeferredSaveWithoutCommit'] = 'Fails on HHVM';
     }
     if (!PhpFilesAdapter::isSupported()) {
         $this->markTestSkipped('OPcache extension is not enabled.');
     }
     return new PhpFilesAdapter('sf-cache');
 }