@ -171,9 +171,9 @@ An optional additional caching mechanism you may use is the realpath_cache_size
See <ahref="http://php.net/manual/en/ini.core.php">the PHP documentation</a>
for more details.
<br/>
<br/>
<br/>
<h3>APC</h3>
If you prefer using <ahref="http://php.net/manual/en/book.apc.php">APC</a>,
If you prefer using <ahref="http://php.net/manual/en/book.apc.php">APC</a>,
you can use the same kind of trick as above, just changing the code a little:
<pre>
$xc = function_exists('apc_exists');
@ -209,6 +209,76 @@ If you prefer using <a href="http://php.net/manual/en/book.apc.php">APC</a>,
}
...
</pre>
<br/>
<br/>
<h3>APCu</h3>
In PHP 5.5 and above, APC is rendered practically obsolete by the presence of ZendOPCache by default.
However, APC does not cover the "user cache", like the caching of specific variables in memory.
Considering this, you can <ahref="http://php.net/manual/en/book.apcu.php">APCu</a> to add the same level of variable caching as described above, just changing the code a little:
<pre>
function return_notification_menu()
{
$_course = api_get_course_info();
$course_id = 0;
if (!empty($_course)) {
$course_id = $_course['code'];
}
$user_id = api_get_user_id();
$html = '';
$cacheEnabled = function_exists('apcu_exists');
if ((api_get_setting('showonline', 'world') == 'true' && !$user_id) ||
if (apcu_exists('my_campus_whoisonline_count_simple_'.$_course['id']) AND (time() < $apc_end) AND apcu_fetch('my_campus_whoisonline_count_simple_'.$_course['id']) > 0) {
if (apcu_exists('my_campus_whoisonline_count_simple_'.$_course['id']) AND (time() < $apc_end) AND apcu_fetch('my_campus_whoisonline_count_simple_'.$_course['id']) > 0) {