Esempio n. 1
0
 /**
  * Refresh the APC cache by deleting APC entries.
  *
  * @return void
  */
 public function refreshAPCCache()
 {
     $configModel = new Default_Model_Configuration();
     $server = $configModel->getKey('api_url');
     $hash = isset($server) ? hash('sha1', $server) : '';
     $cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);
     $cache->delete($hash . '-Output.default-format');
 }
Esempio n. 2
0
 /**
  * Refresh the APC cache by deleting APC entry.
  *
  * @return void
  */
 public function refreshAPCCache()
 {
     $configModel = new Default_Model_Configuration();
     $server = $configModel->getKey('api_url');
     $hash = isset($server) ? hash('sha1', $server) : '';
     $cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);
     $cache->delete($hash . '-Errors.user-defined');
     $cache->delete($hash . '-configFile-errors');
 }
Esempio n. 3
0
 /**
  * Initialize 
  *
  * This method does the pre-requisite for the Controller to work
  * and function correctly
  *
  * @return void
  */
 public function init($styles = array())
 {
     $actions = array('index', 'detail', 'unset', 'unsetall');
     $this->_helper->_acl->allow('admin', $actions);
     $configModel = new Default_Model_Configuration();
     $server = $configModel->getKey('api_url');
     $cache = $configModel->getKey('cache');
     $this->cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);
     $this->hash = isset($server) ? hash('sha1', $server) : '';
     $this->cache_keys = array("Output.default-format", "Errors.user-defined", "Router.routes-prepared", "Internal.database-dsn", "Output.formats-enabled", "Actions.enabled-private", "Actions.enabled-public", "Partners.emails-keys", "Cache.adapter", 'Database.configs');
     parent::init($styles);
 }
Esempio n. 4
0
 /**
  * Refresh the APC cache by deleting APC entries.
  *
  * @return void
  */
 public function refreshAPCCache()
 {
     $configModel = new Default_Model_Configuration();
     $server = $configModel->getKey('api_url');
     $hash = isset($server) ? hash('sha1', $server) : '';
     $cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);
     $cache->delete($hash . '-Actions.enabled-public');
     $cache->delete($hash . '-Actions.enabled-private');
     $cache->delete($hash . '-Router.routes-prepared');
     $cache->delete($hash . '-configFile-actions');
 }
Esempio n. 5
0
 /**
  * Tests Frapi_Cache::getInstance() returns wincache adapter
  */
 public function testGetInstanceAdapterDoesNotExist()
 {
     $this->setExpectedException('Frapi_Cache_Adapter_Exception', 'Frapi_Cache_Adapter_Wtf does not exist');
     $adapter = Frapi_Cache::getInstance('wtf');
 }
Esempio n. 6
0
 /**
  * Constructor
  *
  * This is the constructor of the Frapi_Cache class.
  *
  * @param  string $adapter The adapter to load.
  * @param  array  $options Potentially a list of options per adapter.
  * @return void
  */
 public function __construct($adapter = 'apc', $options = array())
 {
     $this->cacheObject = Frapi_Cache::getInstance($adapter);
 }
Esempio n. 7
0
 /**
  * Delete key from cache(s).
  *
  * This method deletes a key from the cache instance.
  *
  * @param  string  The cached key to delete.
  * @return void
  */
 public static function deleteCached($key)
 {
     self::log('cache-delete', $key);
     $hash = self::getHash();
     if (!isset(self::$cache)) {
         self::$cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);
     }
     return self::$cache->delete($hash . '-' . $key);
 }
Esempio n. 8
0
 public static function getConfiguration($type)
 {
     if (!isset(self::$cache)) {
         self::$cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);
     }
     if (!isset(self::$conf[$type])) {
         self::initConfiguration($type);
     }
     return self::$conf[$type];
 }