protected function renderApcLoad() { if (dmAPCCache::isEnabled() && $this->user->can('systeme')) { $apcLoad = dmAPCCache::getLoad(); return $this->helper->link('dmServer/apc')->set('.tipable.dm_load_monitor.fleft')->title(sprintf('APC usage: %s / %s', $apcLoad['usage'], $apcLoad['limit']))->text(sprintf('<span style="height: %dpx;"></span>', round($apcLoad['percent'] * 0.21))); } }
protected function configureDoctrineCache(Doctrine_Manager $manager) { if (sfConfig::get('dm_orm_cache_enabled', true) && dmAPCCache::isEnabled()) { $driver = new Doctrine_Cache_Apc(array('prefix' => dmProject::getNormalizedRootDir() . '/doctrine/')); $manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $driver); } }
public function initialize(sfEventDispatcher $dispatcher, sfCache $cache = null, $options = array()) { /* * This option is great only if APC is active */ $options['lookup_cache_dedicated_keys'] = dmAPCCache::isEnabled(); /* * Performance cost on debug on is too high */ $options['debug'] = false; parent::initialize($dispatcher, $cache, $options); }
public static function enable($val) { $val = (bool) $val; if ($val && !self::isAvailable()) { throw new dmException('Can not enable APC because it is not available on this environment'); } else { if ($val != self::isEnabled()) { self::clearAll(); } self::$isApcEnabled = $val; } }
public function clearAll() { $success = true; dmFileCache::clearAll(); if (count($survivors = glob(sfConfig::get('sf_cache_dir') . '/*'))) { $success = false; $message = 'Can not be removed from cache : ' . implode(', ', $survivors); $this->dispatcher->notify(new sfEvent($this, 'application.log', array($message, 'priority' => sfLogger::ERR))); } if (dmAPCCache::isEnabled()) { if (!dmAPCCache::clearAll()) { $success = false; $message = 'Can not clear APC cache'; $this->dispatcher->notify(new sfEvent($this, 'application.log', array($message, 'priority' => sfLogger::ERR))); } } $this->dispatcher->notify(new sfEvent($this, 'dm.cache.clear', array('success' => $success))); $this->dispatcher->notify(new sfEvent($this, 'task.cache.clear')); return $success; }
public function getCurrentCacheClass() { return dmAPCCache::isEnabled() ? 'dmAPCCache' : 'dmFileCache'; }