XF 1.3 Setting Up Cache

Divvens

Well-known member
I followed the instructions here: http://xenforo.com/help/cache/

This is currently in my config.php file
PHP:
$config['cache']['enabled'] = true; $config['cache']['frontend'] = 'Core'; $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_'; $config['cache']['backend'] = 'File';

I've read that you also need to assign a file directory of some sort for the Cache to properly work? I'm on "Semi-Dedicated" hosting (it is still shared in a sense, not a vps/dedicated server.) and I wish to utilize the default caching method nothing else.

Do I need to add anything else/do anything else in order to get the Cache working properly?
 
Well, I turned on debug mode and checked, it seems that the cache is working properly but i'm no expert at this. Anyways, are the following statistics good? :o

Page Time: 0.2717s
Memory: 11.6314 MB (Peak: 12.8609 MB)
Queries (11, time: 0.0108s, 4.0%)
 
I still want to know if what I mentioned in the first post (the process mentioned in the official document) is the only process that needs to be followed for setting up the file cache right or do I need to do anything additional.
 
I used to use this when I was on a shared server:
Code:
$config['cache']['enabled'] = true;
$config['cache']['cacheSessions'] = true;
$config['cache']['backend'] = 'File';
$config['cache']['backendOptions'] ['cache_dir'] = '/path/to/cache';
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] ['cache_id_prefix'] = 'xf_';
 
I used to use this when I was on a shared server:
Code:
$config['cache']['enabled'] = true;
$config['cache']['cacheSessions'] = true;
$config['cache']['backend'] = 'File';
$config['cache']['backendOptions'] ['cache_dir'] = '/path/to/cache';
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] ['cache_id_prefix'] = 'xf_';
Yea, I wanted to know if the cache_dir is required as it isn't mentioned in the official documentation, should I also add a path to cache or let it be default the way it is (without directory path)?

And if I need to add a path, should I create a new directory (if yes, then where?)
 
That's not bad for a shared hosting.
It's semi-dedicated, and the host is awesome :P

I'm still confused whether I should add a cache directory and path to it, or not since the official documentation says nothing about a path yet people use a path, if its something that needs to be there for it to work wouldn't it be mentioned in the documents? I'm a noob with it thus confused!
 
Yeah i agree @Divvens, i would like clarification on that too.

Also once the cache has been setup, is there anywhere to check that its actually working? Should the cache directory start getting files in there?
 
I would assume by the statement on the advanced options in the manual page that states
which stores cache data as files in the temporary directory of your server
that it places them in /tmp unless you tell it somewhere else. In fact, when you go to the Full List of File Cache Options on that page it tells you that by default it places them in the system temp directory which on a VPS/dedi will be in /tmp (again usually).

Screen Shot 2014-06-02 at 3.04.52 AM.webp

On a shared hosting - I'm not sure (I never used it much) but I'm sure that each shared hosting account has a /tmp directory for it also.
 
I would assume by the statement on the advanced options in the manual page that states that it places them in /tmp unless you tell it somewhere else. In fact, when you go to the Full List of File Cache Options on that page it tells you that by default it places them in the system temp directory which on a VPS/dedi will be in /tmp (again usually).

View attachment 74965

On a shared hosting - I'm not sure (I never used it much) but I'm sure that each shared hosting account has a /tmp directory for it also.
Indeed, there is a /tmp directory on my server but I don't see any recent files in it, nor do I know infact what cache files are saved as.

Do you suggest me creating a new directory for the cache files? Or should I just let it be as it is now, since it does seem to be working.

Also once the cache has been setup, is there anywhere to check that its actually working? Should the cache directory start getting files in there?
I think the directory should start storing files, but I may be wrong.
 
When I'm still on Shared Host, this is my config:
Code:
    // Cache
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['cacheSessions'] = true;
  
  
    // File Cache
    $config['cache']['backend'] = 'File';
    $config['cache']['backendOptions'] = array('cache_dir'  => 'full_path_to/internal_data/cache');
    $config['cache']['frontendOptions'] = array('caching'  =>  true,
                                                'automatic_serialization' => true,
                                                'lifetime'    => 1800,
                                                'cache_id_prefix'  =>  'xf_'
    );
    // End File Cache
Yes you should declare the path, and also you must create it manually and chmod 777.
 
Indeed, there is a /tmp directory on my server but I don't see any recent files in it, nor do I know infact what cache files are saved as.

Do you suggest me creating a new directory for the cache files? Or should I just let it be as it is now, since it does seem to be working.


I think the directory should start storing files, but I may be wrong.

There is also a /temp directory in your forum setup under the /internal_data. I bet that's where they go by default.

Screen Shot 2014-06-02 at 5.23.43 AM.webp
 
When I'm still on Shared Host, this is my config:
Code:
    // Cache
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['cacheSessions'] = true;
 
 
    // File Cache
    $config['cache']['backend'] = 'File';
    $config['cache']['backendOptions'] = array('cache_dir'  => 'full_path_to/internal_data/cache');
    $config['cache']['frontendOptions'] = array('caching'  =>  true,
                                                'automatic_serialization' => true,
                                                'lifetime'    => 1800,
                                                'cache_id_prefix'  =>  'xf_'
    );
    // End File Cache
Yes you should declare the path, and also you must create it manually and chmod 777.
Must the directory be located inside the internal data directory?
 
What must in the config file, if i only use opcache php 5.5?
For php caching? Just be sure you define a memory amount for it in your php.ini. No additional settings are necessary.
It doesn't have the same features that xCache does and all you can use it for is php opcode caching. If you want to do more then you need to install APCu or memcached.
 
Top Bottom