- Joined
- Sep 13, 2014
- Messages
- 34
- Points
- 8
When you have a server with limited resource that many users accessing your system increasing daily and one day your server will be overloaded because it can not meet the needs from users. Also thinking about upgrading server system? first thing you should think about is, using CACHE. Cache makes your applications load faster because the processor has been previously saved and make your system run server softer. It is effective and why you should use the Cache. Also, using cache for Xenforo to help your forum save processing time and queries for the database, reducing server load, speed up loading time. XenForo capables to store and retrieve data different from a cache system, configured in config.php file in the library folder.
Xenforo cache has 2 types, Cache for front-end and back-end.
Depending on the software installed on your hosting provider, you can activate a cache system base or use more advanced scripts for storing data, such as APC (Alternative PHP Cache) or Memcached.
Front-End Cache
Setting Cache for front-end is very simple, you just add the following codes to your config.php file:
You can change the value 'cache_id_prefix' to suit the individual needs
For example:
If you want your forum read and store the sessions with cache, add this to your config.php file:
Notes:
- Depending on your needs, you can change the options for front-end cache accordingly.
- When using the cache to store sessions to ensure there is enough space to store. If you need to increase space on your hosting, ask your web hosting provider for the support.
- Do not need to store sessions with Cache for Back-end if you use the APC cache.
Back-End Cache
One thing you should know, the type of caching, If storing cache with RAM is always better than hard drive storage on your server. Here are a few types of cache back-ends that you can use for Xenforo:
File Back-End
This is a simple back-end cache, it will store the data on hard disk as temporary files on your hosting/server.
How to set up to store as files:
APC Back-End
If your server installed APC (Alternative PHP Cache) then this should add to the config file
Note that some versions of APC may operate unstable, you should monitor your server for a while to ensure that it runs smoothly.
Memcached Back-End
Setting Memcached back-end as following:
Hope it helps and good luck!
Xenforo cache has 2 types, Cache for front-end and back-end.
Depending on the software installed on your hosting provider, you can activate a cache system base or use more advanced scripts for storing data, such as APC (Alternative PHP Cache) or Memcached.
Front-End Cache
Setting Cache for front-end is very simple, you just add the following codes to your config.php file:
Code:
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
For example:
Code:
$config['cache']['enabled'] = true;
$config['cache']['backend'] = 'File';
$config['cache']['backendOptions'] = array('cache_dir' => '/home/example.com/public_html/internal_data/cache/');
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array('caching' => true,'automatic_serialization' => true,'lifetime' => 3600);
Code:
$config['cache']['cacheSessions'] = true;
- Depending on your needs, you can change the options for front-end cache accordingly.
- When using the cache to store sessions to ensure there is enough space to store. If you need to increase space on your hosting, ask your web hosting provider for the support.
- Do not need to store sessions with Cache for Back-end if you use the APC cache.
Back-End Cache
One thing you should know, the type of caching, If storing cache with RAM is always better than hard drive storage on your server. Here are a few types of cache back-ends that you can use for Xenforo:
File Back-End
This is a simple back-end cache, it will store the data on hard disk as temporary files on your hosting/server.
How to set up to store as files:
Code:
$config['cache']['backend'] = 'File';
If your server installed APC (Alternative PHP Cache) then this should add to the config file
Code:
$config['cache']['backend'] = 'Apc';
Memcached Back-End
Setting Memcached back-end as following:
Code:
$config['cache']['backend'] = 'Memcached';
$config['cache']['backendOptions'] = array(
'compression' => false,
'servers' => array(
array(
// your memcached server IP /address
'host' => 'localhost',
// memcached port
'port' => 11211,
)
)
);