Changing Cache Store
SupportPal uses a file-based cache store to keep regularly requested data readily available and reduce the number of database calls. The used cache store can be changed to other available stores.
Available Cache Stores
- Redis
- File (Default)
The below cache stores are only available on Linux:
-
Memcached - requires the Memcached PECL package to be installed.
Do not use Memcached for both your cache and session driver; we recommend to use Redis instead which offers very similar functionality.
Updating Configuration
Below is an example of updating the configuration to use Memcached.
cache.php
in the /config/production
folder instead of updating the cache.php
found in the main /config
folder, this will mean your configuration is not lost when you update your system.
When utilizing a RAM based store such as APC or Memcached, there might be other applications utilizing the same cache. Please set the 'Cache Key Prefix' to a unique value to avoid collisions.
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => 'memcached',
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'memcached' => [
'driver' => 'memcached',
'persistent_id' => '',
'sasl' => [
'', // Username
'', // Password
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100
],
],
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'supportpal',
];
Redis Configuration
Redis is available for both Linux and Windows, and offers similar performance and functionality to memcached. That being said, the configuration process within SupportPal is slightly more complex as it requires editing a couple of other files - the below steps will guide you through the process.
For information on how to download and install Redis, please visit: https://redis.io/download. Once you have Redis successfully installed, follow the below steps to configure it within SupportPal:
- Make sure your PHP configuration doesn't have any
disable_functions
listed. You can check this via Utilities > PHP Information within the operator panel, but please also ensure your PHP CLI (cron) configuration also has the same setup. -
Add your Redis connection information to
/config/production/database.php
(don't edit your MySQL configuration):If using Redis for both your cache and session driver, please ensure a separate connection is created for the session driver as instructed in Changing File Storage Path. Otherwise when the cache is cleared, all your session data will also be deleted.<?php return [ 'connections' => [ 'mysql' => [ ... ], ], 'redis' => [ 'client' => 'predis', 'default' => [ 'host' => '192.168.1.150', 'port' => 6379, 'database' => 0, ], 'session' => [ 'host' => '192.168.1.150', 'port' => 6379, 'database' => 1, ] ], ];
- Change
/config/production/cache.php
to'default' => 'redis'
(as instructed above in Updating Configuration)