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

How do I enable file caching?

Discussion in 'XenForo Questions and Support' started by ChemicalKicks, Sep 9, 2011.

  1. ChemicalKicks

    ChemicalKicks Well-Known Member

    So the obvious question what would you recommend adding to the config to enable caching?
     
    Andy.N likes this.
  2. Kier

    Kier XenForo Developer Staff Member

    We're using memcached here.
     
    ChemicalKicks likes this.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    It's a shame those of us without caching won't be able to utilise it.

    That'll teach us to be tight gits and use shared hosting :D
     
  4. Cezz

    Cezz Well-Known Member

    Why don't you use a filecache? No additional software to be installed only requires some permission changes... ok not the best but better than no cache at all!
     
    Brogan and Kier like this.
  5. Kier

    Kier XenForo Developer Staff Member

    You can use the file cache on shared hosting :)
     
    Brogan likes this.
  6. Brogan

    Brogan XenForo Moderator Staff Member

    Ah thanks guys, I'll look into that.

    I'll speak to the host and see if it's possible.
     
  7. ChemicalKicks

    ChemicalKicks Well-Known Member

    You shouldn't need to talk to your host about this.


    I had file caching on my old vb4 set-up I'm wondering what I specifically have to add to the config to turn it on though :)
     
  8. Cezz

    Cezz Well-Known Member

    Nothing to really talk to your host about, just edit your config file with the correct options and chmod the filecache folders :) that is unless you are on a 100% managed server
     
  9. ChemicalKicks

    ChemicalKicks Well-Known Member

    What do we need to add to the config!! :D
     
  10. Cezz

    Cezz Well-Known Member

    PHP:
    $config['cache']['enabled'] = true;

    $config['cache']['backend'] = 'File';
    $config['cache']['backendOptions'] = array('cache_dir'  => '{{FULL PATH TO CACHE DIR}}');

    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions'] = array('caching'  =>  true,
                                                
    'automatic_serialization' => true,
                                                
    'lifetime'    => 1800
    );
    Replacing the {{FULL PATH TO CACHE DIR}} To the full path to your cache dir, recomended is /library/cache
     
    drudy, Fuhrmann, Brett Peters and 4 others like this.
  11. ChemicalKicks

    ChemicalKicks Well-Known Member

    Cheers Cezz,

    Couple of things, once I create the directory and add this to the config will it the directory start to populate with the caching stuff? I'm confused to how this works, with vBulletin I added a line to the config but it appeared to create the directory all by itself. :)

    When you say full path to the cache would "/library/cache" be enough? :)
     
  12. Cezz

    Cezz Well-Known Member

    No it would need to be the FULL path I believe eg... /home/user/www/xenforo/library/cache or /www/var/user1/site1/library/cache

    Honestly I am not 100% how it works but I think you need to create the folder and chmod it corrently and then yeah it starts to fill up with the required files.
     
    Brogan likes this.
  13. Kier

    Kier XenForo Developer Staff Member

    FWIW, I'd recommend internal_data/cache, for ease of use.
     
    Brett Peters, Floris, Alien and 2 others like this.
  14. Cezz

    Cezz Well-Known Member

    Awesome thanks for the tips.
     
  15. Brogan

    Brogan XenForo Moderator Staff Member

    Thanks guys.

    Surprised it has to be an absolute full path rather than relative.
     
  16. Cezz

    Cezz Well-Known Member

    I might be wrong about that mind you, either way I would use an absolute path so I know exactly where the cache is going as it could even be outside of your public_html folder if you wanted for some reason!
     
  17. Brogan

    Brogan XenForo Moderator Staff Member

    Yay!
    Just tested it on my local and it works fine :)

    You need to manually create the internal_data/cache directory otherwise you get an exception thrown.

    Thanks again guys.
     
    Cezz likes this.
  18. Kevin

    Kevin Well-Known Member

    I noticed there is an empty internal_data/page_cache folder -- is that one for something else?
     
    Cezz likes this.
  19. Kier

    Kier XenForo Developer Staff Member

    It's for something else in the future...
     
    ibnesayeed and ChemicalKicks like this.
  20. ChemicalKicks

    ChemicalKicks Well-Known Member

    Hey Brogan,
    Glad you got it working.

    I got an exception and I created the folder :eek: What path format you using I tried the auld /home/user/public/ETC but that threw up an exception with this in the error.

    "/var/sites/t/the-sps.org/public_html/library/config.php" so should I be using somthing like the following....

    "/var/sites/t/the-sps.org/public_html/internal_data/cache" should I have a / on the end of that?
     

Share This Page