
I've got it set to 5 seconds, not minutes. Doesn't seem to matterHighway of Life wrote:Indeed it was designed so that it can run on a shared server without a problem.
My board is running on a colo server, so it’s more than enough to handle, but start adding thousands of users per hour and you have a problem with all those extra queries, no matter how powerful the server is.![]()
Though for your situation currently 5 minutes should be fine.
Code: Select all
<table class="tablebg" width="100%" cellspacing="{$CA_SPACING}">
{$CA_CAP_START}{L_STATISTICS}{$CA_CAP_END}
<tr>
<td class="row1"><img src="{T_THEME_PATH}/images/stats.gif" alt="{L_STATISTICS}" /></td>
<td class="row1 nobold" width="100%" valign="middle"><p class="genmed">{TOTAL_POSTS} | {TOTAL_TOPICS} | {TOTAL_USERS} | {AVG_POSTS} | {NEWEST_USER}</p></td>
</tr>
</table>
<br clear="all" />
<!-- IF not S_IS_BOT -->
<table class="tablebg" width="100%" cellspacing="{$CA_SPACING}">
{$CA_CAP_START}{L_24HOUR_STATS}{$CA_CAP_END}
<tr>
<td class="row1 nobold" width="100%" valign="middle"><p class="genmed">{24HOUR_POSTS} | {24HOUR_TOPICS} | {24HOUR_USERS}</p></td>
</tr>
</table>
<!-- ENDIF -->
<br clear="all" />
Code: Select all
<br clear="all" />
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<td class="cat" colspan="2"><h4>{L_STATISTICS}</h4></td>
</tr>
<tr>
<td class="row1"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_STATISTICS}" /></td>
<td class="row1" width="100%" valign="middle"><p class="genmed">{TOTAL_POSTS} | {TOTAL_TOPICS} | {TOTAL_USERS} | {AVG_POSTS} | {NEWEST_USER}</p></td>
</tr>
</table>
<br clear="all" />
<!-- IF not S_IS_BOT -->
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<td class="cat" colspan="2"><h4>{L_24HOUR_STATS}</h4></td>
</tr>
<tr>
<td class="row1" width="100%" valign="middle"><p class="genmed">{24HOUR_POSTS} | {24HOUR_TOPICS} | {24HOUR_USERS}</p></td>
</tr>
</table>
<!-- ENDIF -->
Code: Select all
<h3>{L_STATISTICS}</h3>
<p>{TOTAL_POSTS} • {TOTAL_TOPICS} • {TOTAL_USERS} • {AVG_POSTS} • {NEWEST_USER}</p>
<!-- IF not S_IS_BOT -->
<h3 id="24hour_stats">{L_24HOUR_STATS}</h3>
<p>{24HOUR_POSTS} • {24HOUR_TOPICS} • {24HOUR_USERS}</p>
<!-- ENDIF -->
Code: Select all
<h3>{L_STATISTICS}</h3>
<p>{TOTAL_POSTS} • {TOTAL_TOPICS} • {TOTAL_USERS} • {AVG_POSTS} • {NEWEST_USER}</p>
<!-- IF not S_IS_BOT -->
<h3 id="24hour_stats">{L_24HOUR_STATS}</h3>
<p>{24HOUR_POSTS} • {24HOUR_TOPICS} • {24HOUR_USERS}</p>
<!-- ENDIF -->
Ah hmm... in that case, you don’t want it throwing to the cache at all, as at a 5 second interval, you may only be increasing the load just a bit... you could make them strict queries by commenting out the $cache->put line.*Capmaster* wrote:I've got it set to 5 seconds, not minutes. Doesn't seem to matter![]()
Code: Select all
// cache this data for 1 hour, this improves performance
// $cache->put('_activity_mod', $activity, 3600);
Code: Select all
// obtain user activity data
// $active_users = obtain_active_user_data();
// obtain posts/topics/new users activity
$activity = obtain_activity_data();
/*
// 24 hour users online list, assign to the template block: lastvisit
foreach ($active_users as $row)
{
$template->assign_block_vars('lastvisit', array(
'USERNAME_FULL' => get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
));
}
*/
// assign the stats to the template.
$template->assign_vars(array(
// 'USERS_24HOUR_TOTAL' => sprintf($user->lang['USERS_24HOUR_TOTAL'], sizeof($active_users)),
'24HOUR_TOPICS' => sprintf($user->lang['24HOUR_TOPICS'], $activity['topics']),
'24HOUR_POSTS' => sprintf($user->lang['24HOUR_POSTS'], $activity['posts']),
'24HOUR_USERS' => sprintf($user->lang['24HOUR_USERS'], $activity['users']),
));