/** * @param string $name * @param mixed $value * @return array */ public static function dailyValue( $name, $value = null) { if ( $value === null && isset($memoryCache[$name]) ) { return self::$memoryCache[$name]; } else { $cache = new eZPHPCreator( eZSys::cacheDirectory(), self::GLOBAL_CACHE_FILE . '.php', '', array() // removed clustering ); $expiryTime = time() - 24 * 3600; // reading if ($cache->canRestore($expiryTime)) { $values = $cache->restore(array('cacheTable' => 'cacheTable')); self::$memoryCache = $values['cacheTable']; if (is_null($value)) { if (isset($values['cacheTable'][$name])) { return $values['cacheTable'][$name]; } else { return null; } } } else { $values = array('cacheTable' => array()); } if ( !is_null($value) ) { $values['cacheTable'][$name] = $value; $cache->addVariable('cacheTable', $values['cacheTable']); $cache->store(true); $cache->close(); } } return null; }
/** * @return array */ public static function getPublisherFolderRelationsFromCache() { $publisherRelations = GlobalCacheTool::dailyValue('publisher_folder_relations'); if ( is_null($publisherRelations) || !$publisherRelations ) { $publisherRelations = self::getAllPublisherFoldersRelations(); GlobalCacheTool::dailyValue('publisher_folder_relations', $publisherRelations); } return $publisherRelations; }