本文整理匯總了PHP中cache_helper::get_cache_stores方法的典型用法代碼示例。如果您正苦於以下問題:PHP cache_helper::get_cache_stores方法的具體用法?PHP cache_helper::get_cache_stores怎麽用?PHP cache_helper::get_cache_stores使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cache_helper
的用法示例。
在下文中一共展示了cache_helper::get_cache_stores方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create_cache
/**
* Common public method to create a cache instance given a definition.
*
* This is used by the static make methods.
*
* @param cache_definition $definition
* @return cache_application|cache_session|cache_store
* @throws coding_exception
*/
public function create_cache(cache_definition $definition)
{
$class = $definition->get_cache_class();
if ($this->is_initialising()) {
// Do nothing we just want the dummy store.
$stores = array();
} else {
$stores = cache_helper::get_cache_stores($definition);
}
if (count($stores) === 0) {
// Hmm no stores, better provide a dummy store to mimick functionality. The dev will be none the wiser.
$stores[] = $this->create_dummy_store($definition);
}
$loader = null;
if ($definition->has_data_source()) {
$loader = $definition->get_data_source();
}
while (($store = array_pop($stores)) !== null) {
$loader = new $class($definition, $store, $loader);
}
return $loader;
}