Advertisement:

Author Topic: Menu and caching  (Read 1883 times)

Offline tohtori

  • Semi-Newbie
  • *
  • Posts: 12
    • Xxonkforia eroottinen foorumi
Menu and caching
« on: December 11, 2008, 03:49:36 PM »
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:
Code: [Select]
$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!

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,868
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Menu and caching
« Reply #1 on: December 12, 2008, 02:57:04 PM »
Replace the first line of code with this:

Code: [Select]
$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.
Michael Eshom
Cincy Space - now open!

Offline tohtori

  • Semi-Newbie
  • *
  • Posts: 12
    • Xxonkforia eroottinen foorumi
Re: Menu and caching
« Reply #2 on: December 14, 2008, 07:47:56 AM »
Thank you. That made the trick :)