1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to know cache is working?

Discussion in 'XenForo Questions and Support' started by craigiri, May 31, 2012.

  1. craigiri

    craigiri Well-Known Member

    Based on the cache suggestions given here:
    http://xenforo.com/help/cache/

    How does one know that cache is working?

    Specifically, in the first two instances, cache front end and back end file store, is there a place on my server where the files are kept so that I can confirm that things are working? Would the config throw an error if it was not?

    Also, is file back end store really any better than the built-in Linux (and other nix) automatic caching of virtually all served data?

    Someone should write up a white paper on ALL these items!

    Any info welcome!
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    With the file cache you can look in the cache directory that you specified. Also, enabling debug mode will let you see the load stats to see how the cache affects query count and whatnot.

    With APC you need to upload the apc.php script to see the status of the cache:

    https://www.google.com/search?q=apc.php&tbm=isch
     
  3. craigiri

    craigiri Well-Known Member

    Thanks Jake...but neither of the first two options at:
    http://xenforo.com/help/cache/
    specify a directory!

    The first specifies a prefix, which I have looked for files with "xf_" or "xf_*" and not found any related to cache.

    Maybe I'll try the debug mode - but it would sure be nice to know where the gears are! I see that the Zend page says it would be the "default system temp" directory, but cannot find where that might be. My guess is that I may have to specify one in the directory with xf since it may not have permission to write elsewhere - I can only assume that most hosts keep the temp or tmp directory in the same part of the tree as each specific user, as opposed to elsewhere.

    Edit - it seems the problem is that there is no temp directory set. This must be set either through the config or at the file Zend/Cache/Backend/File.php

    My first attempt at creating a directory and pointing to it failed - the whole site went down! Directory was writeable and full path from server root was specified. Maybe I have to just have path from Zend instance?
     
    yoghurtfarmer likes this.
  4. craigiri

    craigiri Well-Known Member

    Ah, got it!

    The path must be set from the XF root. I also put the tmp directory in that same root.

    so, inside the file 'File.php" in Zend/Cache/Backend
    you need to change as follows - it is set as null by default. I assume you could also specify this in the XF config.php with another line or array.

    Code:
      protected $_options = array(
            'cache_dir' => 'tmp/',
    and, of course, you must have a fully writeable and readable tmp directory inside your XF root directory!

    So this is the file backend store.

    My assumption is that the frontend is a memory based cache? In this case, there is no directory for it? Or should this one also exist somewhere?
     
    yoghurtfarmer likes this.
  5. craigiri

    craigiri Well-Known Member

    Adding to this thread in case anyone else runs into this - I used redirects from my old forum, so each of these threw errors with the cache setup! This must be due to Zend looking for the tmp cache directory in the old file structure (for my old forum).

    My quickie solution was to create tmp directories in one or two other directories where XF and Zend were looking for them!
     

Share This Page