LCache Speed Up

xF1 Beta LCache Speed Up 1.0.4

No permission to download
Compatible XF Versions
  1. 1.3
  2. 1.4
  3. 1.5
LCache is a caching solution that creates multiple layers to store data. It allows for reads to be stored within APCu or SQLite for speed while it stores the data in a second layer on your database. This makes caching for users simple as most already have these two setup! It also makes it possible for a master-master caching solution that is inexpensive and very fast.

On my website I dropped from 0.6s to 0.06s! My setup is a geo-replicated WAN cluster so people with similar configurations will see great performance increase! Your experience may vary :)

You can read more about LCache by clicking here!

All you need to set this up is PHP 5.6 or greater and APCu.
Install the add-on and go into your config.php and put these lines somewhere after the database options:
PHP:
if (php_sapi_name() !== 'cli') {
$config['cache']['backend'] = 'LCache';
$config['cache']['backendOptions'] = array(
'l2' => array(
'type' => 'mysql',
'prefix' => 'xf_',
'config' => $config['db']
)
);
}
Once this is in your config.php you are done!

Available options for the configuration are as follows:
PHP:
// Define a bin where it will be stored. Allows for multiple sites to use the caching service on the same DB.
'bin' => 's1',
// The PHP pool. Define a custom one, use null for the pool IP/ID, or use hostname to use your server's hostname.
'pool' => null,
// Used internally. Does not apply to XF.
'group' => 'default',
// Whether or not an item has an expiration date.
'can_expire' => true,
// L1 Configuration
'l1' => array(
'type' => 'apcu',
'config' => array()
),
// L2 Configuration
'l2' => array(
'type' => 'mysql',
'prefix' => 'xg_',
'config' => array()
)
Initial page loads may be longer than usual as it is transferring the cache from the data registry to the LCache table.

The add-on also includes a cron entry that performs garbage collecting once a day.

LCache is currently in alpha so if something funky happens, please report it. If you find that your actions aren't being synced correctly or something feels "broken", simply comment out the back-end options in your config.php and rebuild the master data. That will resolve all issues.

CLI is currently not supported. It will most likely crash your database server if your website has a large amount of traffic.

LCache GitHub Repo:
Click here to contribute!

Add-On GitHub Repo:
Click here to contribute!
Author
AnimeHaxor
Size
36.3 KB
Extension
zip
Downloads
9
Views
1,089
First release
Last update

More resources from AnimeHaxor

Latest updates

  1. Version 1.0.4 Released

    Fixed uninstalling issue!
  2. Minor fix

    Just a small fix.
  3. Missing File

    Forgot the missing file.

Similar resources

731Threads
2,287Messages
63,888Members
VncoLatest member
Back