CMS Widget "Cache refresh time" doesn't seem to work.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeejuh
    New Member
    • Jun 2008
    • 12
    • 4.0.x

    [CMS] CMS Widget "Cache refresh time" doesn't seem to work.

    I have PHP Direct Execution widget that I have set the "Cache refresh time" to 0 (zero), but it still doesn't update with every refresh.

    A workaround that I've found is that I can reset the "Cache refresh time", either putting it up to 1 or back down to 0, and then when I refresh the page I will get the new content. But I don't want it to cache ever.

    I have other PHP Direct Execution widgets that I have set the "Cache refresh time" to 0, and they work as expected, updating with every refresh.

    Any ideas as to why this one widget is still caching?
  • Edwin Brown
    Former vBulletin Developer
    • Mar 2009
    • 1393
    • 5.5.x

    #2
    See http://tracker.vbulletin.com/browse/VBIV-8082.
    Please- I'm not tech support. Don't send your problem reports to me unless I've asked you to.

    Comment

    • jeejuh
      New Member
      • Jun 2008
      • 12
      • 4.0.x

      #3
      Sweet! Fixed. Thank you.

      Comment

      • david4514
        New Member
        • Feb 2010
        • 11
        • 4.0.0

        #4
        I also have the same issue. The suggestion in VBIV-8082 seems to be working.

        Comment

        • Steve_GB
          New Member
          • Oct 2003
          • 16
          • 4.0.x

          #5
          I have this problem and can't seem to get the fix to work for me in 4.07

          It is very annoying that our random photos in widgets are actually staying the same for ages. I don't really understand why we don't seem to have full control over all the cache systems and their settings.

          I am probably adding this line to the wrong place somehow:

          Unknown macro: { vB_Cache}

          ..as it doesn't seem very clear where that goes.

          If anyone can explain/show exactly what the code should become in the 4.07 file that would be great.

          Steve

          Comment

          • Lynne
            Former vBulletin Support
            • Oct 2004
            • 26255

            #6
            It looks like first you comment out these lines:
            PHP Code:
            /*        if (!isset($config['cache_ttl']) )
                    {
                        $config['cache_ttl'] = 5;
                    }
            */ 
            and then add a condition around this text:
            PHP Code:
                        if ($config['cache_ttl'] > 0) {
                        
            vB_Cache::instance()->write($hash,
                           
            $output$config['cache_ttl'],
                           array(
            $this->package '_event_' $this->class '_' $this->widget->getId()));
                         } 

            Please don't PM or VM me for support - I only help out in the threads.
            vBulletin Manual & vBulletin 4.0 Code Documentation (API)
            Want help modifying your vbulletin forum? Head on over to vbulletin.org
            If I post CSS and you don't know where it goes, throw it into the additional.css template.

            W3Schools <- awesome site for html/css help

            Comment

            • Steve_GB
              New Member
              • Oct 2003
              • 16
              • 4.0.x

              #7
              Lynne,

              Thanks for your clear explanation. I made those changes and it now runs where I was adding in bits that were not needed from the earlier info.

              However, I then tried checking a random photo PHP widget on our CMS 4.07 front page and it did not change when I hit F5. I tried many times and each time I got the same set of random photos - which of course ruins that whole concept... The setting for that widget is 0 for cache.

              I went to the Clear CMS cache command and as usual when I then returned to the front page of our CMS and the widget on it the images changed, once, and then were cached again.

              Our work around at present is that we have something running to clear the CMS cache every 5 minutes and at least that way the front page isn't quite so painful to look at as it does change at times due to that.

              If we set widgets for 0 cache is would be great if they just did that.. and I would never ever want the front page of our CMS cached as it is packed with 'live' information and random items. I can see no controls for turning off whatever cache is at work though.

              Thanks for your great work on here,

              Steve

              Comment

              • Removed-836727
                Banned by User Request
                • Apr 2006
                • 1274

                #8
                What's the php code you're using?

                Comment

                • Wayne Luke
                  vBulletin Technical Support Lead
                  • Aug 2000
                  • 74153

                  #9
                  I wouldn't recommend turning off the cache at all. There is no way to do it just for the front page or specific widgets. You can turn it off globally under Settings -> Options -> Server Settings and Optimization Options. You'll most likely notice an increase in page load times and heavier server loads though.
                  Translations provided by Google.

                  Wayne Luke
                  The Rabid Badger - a vBulletin Cloud demonstration site.
                  vBulletin 5 API

                  Comment

                  • Removed-836727
                    Banned by User Request
                    • Apr 2006
                    • 1274

                    #10
                    I wouldn't recommend turning off the cache at all. There is no way to do it just for the front page or specific widgets.
                    What?
                    You (can/should be able to) disable the cache for php direct execution widgets

                    There are many scenarios where i needed it, that's how i found out that the code is buggy...

                    Comment

                    • Steve_GB
                      New Member
                      • Oct 2003
                      • 16
                      • 4.0.x

                      #11
                      Ragtek,

                      The PHP code doesn't matter as this affects all such widgets on the front CMS page. None of them change once the system starts to cache the front page and widgets on our CMS system. All the widgets are set for 0 cache and from the look of the talk of a fix in 4.8 this is a known bug.

                      We have a random member one, random photo ones, quotes, live counts, live member info, live forum info, etc etc.. all get stuck/useless if cached and the notion that you cache whole pages of widgets packed with live info seems a little odd to me.

                      This also hasn't always been the case, some versions of 4.0x did not have this effect.. but 4.07 seems to simply freeze the front page and that seems a strange thing for anyone to want.

                      I'll probably try the tip above for turning off the cache for now and see how that works out, and if fine maybe stay that way til 4.08 is out.

                      Steve

                      Comment

                      • Lionel
                        Senior Member
                        • Apr 2001
                        • 688

                        #12
                        The code posted by Lynne (from the bugs report) solves the problem

                        Look at random product and random testimonial Refresh page

                        Comment

                        • Steve_GB
                          New Member
                          • Oct 2003
                          • 16
                          • 4.0.x

                          #13
                          Wayne,

                          Thanks for that info on how to turn off the cache. I have done that and everything seems to work perfectly with that setting changed.

                          A system with a locked up front page full of widgets is no use at all really.. so this is at least working and so a lot better. It does seem amazing that the only control we are given is all of nothing like this.

                          All I actually want to turn off is the CMS cache, and like a lot of folks seem to have done it is setup on a timer to clear every 5 mins anyway - code to do things like that is on vb.org as so many folks seem to want to unstick things the caches are stopping working.

                          I don't understand why the 0 cache setting on widgets is not working. Nor why the CMS cache when cleared lets all the widgets change once and then insists on caching them again, aren't they meant to have their own individual caches and settings.

                          Oh well... not a lot more can be done without 4.8 I guess, which lists that 0 cache bug as one of its fixes I believe.

                          We have a powerful dedicated server so may be able to cope until this all just works again.

                          Steve

                          Comment

                          • Steve_GB
                            New Member
                            • Oct 2003
                            • 16
                            • 4.0.x

                            #14
                            Lionel,

                            MANY thanks for the link etc. You convinced me that it could be made to work so I tried and tried again... finally just got there. I simply needed to add an extra } to the code I had ended up with after the tips above etc.

                            Your site and what you do looks interesting.. I may send you some ideas...

                            Steve

                            Comment

                            • zushiba
                              Member
                              • Dec 2008
                              • 52

                              #15
                              wait, nevermind my cache settings worked after clearing the cache Oo
                              Last edited by zushiba; Wed 9 Feb '11, 12:00pm.

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...