In my website, users will be redirected to a "frontpage" page where they will be able to see the latest news, their special announcements, their own materials, etc. Now I have to use DB to retrieve all those information. I also want to use caching for this purpose so the data on their frontpage refresh every 3 hours let's say instead of each visit.
I am using the following function to achieve this:
function mymodule_cache($reset = FALSE) {
static $my_data;
global $user;
if (!isset($my_data) || $reset) {
if (!$reset && ($cache = cache_get('user_data:' . $user->uid)) && !empty($cache->data)) {
$my_data = unserialize($cache->data);
}
else {
$my_data = ... (This is where I do all the DB queries, etc.);
cache_set('user_data:' . $user->uid, serialize($my_data), 'cache', time() + 10800);
}
}
return $my_data;
}
now this works great, but my question is how if I have tons of users, let's say 10,000 users, would it be efficient to still using this caching method since we are filling up the table rows with data?
Or if not, what is the best solution?
Thanks Luca