public static function flushTableDataCache($table_name) { $cacheKey = sprintf('table_%s', $table_name); $cacher = CacheFactory::get(null, 'db'); $cacher->delete($cacheKey); // pre($cacher, $cacheKey); return true; }
protected function getCacher() { if (!isset($this->_cacher)) { $cacher_name = 'dbal_cache'; $cacher_namespace = sprintf('table_%s_%s', Application::getApp()->getName(), str_replace('.', '_', $this->_table->getTableName())); $this->_cacher = CacheFactory::get($cacher_name, $cacher_namespace); } return $this->_cacher; }
protected function __construct() { $cacher = CacheFactory::get('config_cache', 'schema'); //pre($cacher); $data = $cacher->get('schemas'); if (empty($data)) { //pre($cacher->getAllKeys(), $data); $this->retrieveSchema(); $cacher->set('schemas', $this->_schemas, 0); } else { $this->_schemas = $data; } }
/** * * @param string $namespace * @return ICacher */ protected function getCacher($namespace) { if (!isset($this->_cachers[$namespace])) { $config = Config::getInstance(); $server_name = $config->get('crud.' . $this->_table->getServerName() . '.' . $this->_table->getTableName() . '.cache.server'); if (!$server_name) { $server_name = 'default'; } //make sure the namespace is unique $cacher_namespace = $this->resloveNamespace($namespace); $this->_cachers[$namespace] = CacheFactory::get($server_name, $cacher_namespace); } return $this->_cachers[$namespace]; }
public function __construct($namespace = '') { $this->_namespace = sprintf('__storage__%s', $namespace); $this->_cacher = CacheFactory::get('memcache', $this->_namespace); }
private function loadConfig($config_name) { if (in_array($config_name, $this->_config_loaded)) { return; } $this->_config_loaded[] = $config_name; if ($config_name == 'cache') { //cache config will always read from yml file $data = false; } else { $cacher = CacheFactory::get('config_cache', 'file_config'); $data = $cacher->getDelay($config_name); //$cacher = CacheFactory::get('config_cache', 'config'); if ($data !== false && $data != ICacher::EMPTY_VALUE) { $this->_container->set($config_name, $data); } } if ($data === false) { //get from yml file $config_file = $this->getConfigFolder() . $config_name . '.yml'; if (file_exists($config_file)) { $data = Yaml::parse($config_file); $this->_container->set($config_name, $data); } //write to cache if ($config_name != 'cache') { Logger::getInstance('config')->addNotice(sprintf('parse %s file', $config_file)); if (empty($data)) { $data = ICacher::EMPTY_VALUE; } $cacher->set($config_name, $data); } } }