-
Notifications
You must be signed in to change notification settings - Fork 252
Cache
PATHFINDER stores some cached data (SQL query results, key => value cache data) in tmp/cache/
directory.
This is fine for smaller installations (~ 50 active users). This is the default configuration.
For larger installations or better performance I recommend a in memory cache backend like Redis.
Advantages:
- Redis is an in memory cache that stores all data in your RAM rather than on your slow HDD.
- Redis dumps all data from time2time on your HDD. This helps to keep/reload data on server restart
- Redis has an advanced search/write algorithm that speeds up Pathfinder a lot
Redis setup [optional]
- Install Redis PHP extension -> https://serverpilot.io/community/articles/how-to-install-the-php-redis-extension.html
- Check your
showinfo();
page for PHP. You should find something like: - Go to your
/setup
page and check the Requirements section:
- Check your
- Install Redis server -> https://redis.io/topics/quickstart
- Setup Redis as an LRU (Least recently used) cache -> https://redis.io/topics/lru-cache
- [optional] Set Redis as default Session handler for all your PHP projects on your server. Change these lines in your
php.ini
:session.save_handler = redis session.save_path = "tcp://localhost:6380?database=0"
Hint: Default Redis port is
6380
. Redis spawns 15 empty databases on start. We take the firstdatabase=0
for all global PHP session data. - Change
CACHE
value in your/app/config.ini
file like this:CACHE = redis=localhost:6380:1
CACHE = redis=localhost:6380:1 SESSION_CACHE = default
Hint: We use a fresh DB
:1
for all Pathfinder related cache data. ChangeSESSION_CACHE
todefault
in order to use the global PHP Session handler (see 4.)
Check if everything is working. Go to your /setup
page and check the Directories section. If the PHP framework is able to connect to your new Redis server, the CACHE
value has changed like this:
If everything is working, the
/tmp/cache
directory should be empty all the time and is no longer used.