本文整理汇总了PHP中course_modinfo::cacheaccessed方法的典型用法代码示例。如果您正苦于以下问题:PHP course_modinfo::cacheaccessed方法的具体用法?PHP course_modinfo::cacheaccessed怎么用?PHP course_modinfo::cacheaccessed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类course_modinfo
的用法示例。
在下文中一共展示了course_modinfo::cacheaccessed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear_instance_cache
/**
* Clears the cache used in course_modinfo::instance()
*
* Used in {@link get_fast_modinfo()} when called with argument $reset = true
* and in {@link rebuild_course_cache()}
*
* @param null|int|stdClass $courseorid if specified removes only cached value for this course
*/
public static function clear_instance_cache($courseorid = null) {
if (empty($courseorid)) {
self::$instancecache = array();
self::$cacheaccessed = array();
return;
}
if (is_object($courseorid)) {
$courseorid = $courseorid->id;
}
if (isset(self::$instancecache[$courseorid])) {
// Unsetting static variable in PHP is peculiar, it removes the reference,
// but data remain in memory. Prior to unsetting, the varable needs to be
// set to empty to remove its remains from memory.
self::$instancecache[$courseorid] = '';
unset(self::$instancecache[$courseorid]);
unset(self::$cacheaccessed[$courseorid]);
}
}