Documentation
Cache Driver
Servd allows you to choose which caching driver Craft CMS uses for each environment. The best one depends on your project.
Options #
Redis (default)
Fast in-memory caching, but with limited capacity. Restarting Redis, spike protection or upgrading or downgrading your plan will wipe all of Craft's caches as well as Servd's origin static cache.
Best used when reducing response time is most important.
Database
Uses your project's database to store cached data. Reads and writes are marginally slower versus Redis, but capacity is effectively unlimited. Any cached content will persists indefinitely unless it is manually cleared or cleared by the project's post-deploy tasks.
Best used when:
- Redis is quickly hitting it's max memory capacity, causing poor cache hit rate.
- The project needs a lot of cache storage capacity.
- A cache stampede caused by Redis restarting regularly causes service disruption.
Changing the Cache Driver #
-
Navigate to your staging, development or production environment's Static Caching page.
-
Scroll to the "Cache Driver" section.
-
Select a cache driver option.
-
Click the "Save" button.
-
Sync the project.
Switching to the Database Driver #
When you switch an environment to the database driver and save, Servd will automatically run the following Craft command on that environment to create the required cache table:
./craft setup/db-cache-tableAfter enabling the database driver, we would recommend adding Craft's cache table to the environment's excluded backup database tables.