News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Menu and caching

Started by tohtori, December 11, 2008, 03:49:36 PM

Previous topic - Next topic

tohtori

Hey!

I have a problem with the menubar. Since I have a chat button which then indicates the amount of people in chat. And then I use caching in the forum. How may I substitute the menu from being cached.

Probably it has to do something with the following code from Subs.php:
$cacheTime = $modSettings['lastActive'] * 60;

// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
if (($buttonData = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{
$buttons = array(


But how I could manage to force it to always regenerate the menus?

Thanks for answers!

Oldiesmann

Replace the first line of code with this:

$cacheTime = time();

That will trick SMF into thinking that the settings have been updated since the data was last cached, causing it to always re-load the info.

tohtori

Thank you. That made the trick :)

Advertisement: