本文整理匯總了PHP中CacheManager::saveResource方法的典型用法代碼示例。如果您正苦於以下問題:PHP CacheManager::saveResource方法的具體用法?PHP CacheManager::saveResource怎麽用?PHP CacheManager::saveResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CacheManager
的用法示例。
在下文中一共展示了CacheManager::saveResource方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadConfig
/**
* Load the application config
* @return Config
*/
protected function loadConfig()
{
$config = null;
if (CacheManager::resourceExists(self::CONFIG_RESOURCE_NAME, CacheManager::APPLICATION_SCOPE)) {
$config = CacheManager::loadResource(self::CONFIG_RESOURCE_NAME, CacheManager::APPLICATION_SCOPE);
} else {
$config = ConfigLoader::load(CONFIG_FILE);
CacheManager::saveResource(self::CONFIG_RESOURCE_NAME, $config, CacheManager::APPLICATION_SCOPE);
}
PiconApplication::get()->getConfigLoadListener()->onConfigLoaded($config);
return $config;
}
示例2: load
public function load(Config $config)
{
$this->resourceMap = CacheManager::loadResource(self::CONTEXT_RESOURCE_NAME, CacheManager::APPLICATION_SCOPE);
if ($this->resourceMap == null) {
ApplicationInitializer::loadAssets(ASSETS_DIRECTORY);
$this->resourceMap = $this->loadResourceMap($this->getClasses());
CacheManager::saveResource(self::CONTEXT_RESOURCE_NAME, $this->resourceMap, CacheManager::APPLICATION_SCOPE);
}
$this->createResources();
$this->loadDataSources($config->getDataSources());
return new ApplicationContext($this->resources);
}
示例3: __construct
private function __construct(Component $component)
{
$this->component = $component;
$page = $component->getPage() == null ? "" : get_class($component->getPage());
$resourceName = self::PROPERTIES_CACHE_NAME . '_' . $page . '_' . $component->getComponentPath();
if (CacheManager::resourceExists($resourceName, CacheManager::APPLICATION_SCOPE)) {
$this->properties = CacheManager::loadResource($resourceName, CacheManager::APPLICATION_SCOPE);
} else {
$this->properties = $this->getProperties($this->component);
CacheManager::saveResource($resourceName, $this->properties, CacheManager::APPLICATION_SCOPE);
}
}
示例4: loadMarkup
/**
* Load the associated markup file for a component
* @param Component $component
* @return MarkupElement The root markup tag, populated with child tags
*/
public function loadMarkup(Component $component)
{
$name = get_class($component);
$fileSafeName = str_replace('\\', '_', $name);
if (PiconApplication::get()->getProfile()->isCacheMarkup()) {
if (CacheManager::resourceExists(self::MARKUP_RESOURCE_PREFIX . $fileSafeName, CacheManager::APPLICATION_SCOPE)) {
return CacheManager::loadResource(self::MARKUP_RESOURCE_PREFIX . $fileSafeName, CacheManager::APPLICATION_SCOPE);
} else {
$markup = $this->internalLoadMarkup($name);
CacheManager::saveResource(self::MARKUP_RESOURCE_PREFIX . $fileSafeName, $markup, CacheManager::APPLICATION_SCOPE);
return $markup;
}
} else {
return $this->internalLoadMarkup($name);
}
}
示例5: __destruct
public function __destruct()
{
foreach ($this->pageInstances as $pageid => $page) {
CacheManager::saveResource($pageid, $page, CacheManager::SESSION_SCOPE);
}
$_SESSION['page_map'] = serialize($this);
}
示例6: __destruct
public function __destruct()
{
CacheManager::saveResource(self::AUTO_LOAD_RESOURCE_NAME, $this->cachedPaths, CacheManager::APPLICATION_SCOPE);
}