Cache Settings

Choose where TruCMS stores temporary cache data, prepare the selected service correctly, and control full-page response caching.

Cache settings page in TruCMS

The Cache page selects the cache driver and controls response caching.

What the Cache settings control

TruCMS uses a cache to avoid rebuilding the same information on every request. The Cache Driver decides where that temporary data is stored. This setting is separate from Response Cache, which can store complete public responses for faster repeat visits.

For a normal single-server installation, File is the least complicated choice. Redis or Memcached make more sense when your hosting already provides those services or when multiple application servers need to share cached data.

Do not select a network cache before it exists

If you choose Redis or Memcached before the service and PHP support are available, pages that need cache access can fail. Prepare the service first, then change the driver.

Choosing a Cache Driver

DriverUse it whenSetup needed
File (default)You have one application server or ordinary shared hosting.No external service. TruCMS writes cache files into its writable storage area.
Alternative PHP Cache (APC)Your PHP environment has APCu enabled and you want local in-memory cache on one server.APCu PHP extension must be installed/enabled for the website's PHP runtime.
DatabaseYou want a shared cache without operating Redis/Memcached and can accept extra database traffic.No external cache service; the application database must remain healthy and responsive.
MemcachedYour host provides Memcached and the PHP Memcached extension.Memcached service, host/port, optional authentication, PHP extension.
RedisYour host provides Redis, especially when the same Redis service will also support queues.Redis service, host/port, optional authentication/database, compatible PHP Redis support.

Set up File cache

File cache is the default and usually needs no service configuration.

  1. Open Settings → Cache.
  2. Select File (default).
  3. Save changes.
  4. If you changed from another driver, use Clear Cache once and then test the public site and Admin Panel.

If File cache fails to write, first check the application's writable storage permissions as described in Preparing Your Server.

Set up Alternative PHP Cache (APC)

This option uses APCu memory inside the PHP server. It is appropriate only when APCu is actually enabled for the PHP version serving TruCMS.

  1. Ask your host to enable the APCu PHP extension, or enable it in your hosting PHP Extensions panel if your plan exposes that control.
  2. Confirm APCu is enabled for the same PHP version used by the website.
  3. Select Alternative PHP Cache (APC) in TruCMS and save.
  4. Open several frontend/admin pages and confirm there are no cache-driver errors.

APC is local to one server

It is not the best choice for a multi-server installation because each server has its own memory cache.

Set up Database cache

Database cache stores temporary cache records in the same database environment used by TruCMS. It is simple to operate because there is no separate cache server.

  1. Confirm the main TruCMS database is healthy and has enough capacity for additional cache reads/writes.
  2. Select Database and save.
  3. Use Clear Cache, then test normal page loads.

This can be useful when you need shared cache across web processes but cannot run Redis or Memcached. On a high-traffic site, however, it adds load to the database that also serves normal application data.

Set up Memcached

Memcached is an external in-memory cache. Your host must provide the service and PHP's memcached extension.

Memcached cache configuration fields in TruCMS

Selecting Memcached reveals the connection fields needed to reach the Memcached service.

  1. Obtain the Memcached host and port from your hosting provider. The usual local defaults are 127.0.0.1 and 11211, but use the values supplied for your server.
  2. If the service uses SASL authentication, obtain the username and password. Leave them blank when the service does not use authentication.
  3. Enable the PHP Memcached extension for the website's PHP version.
  4. In TruCMS, select Memcached and complete Host, Port, Username, Password and (if your host requires one) Persistent ID.
  5. Save, clear cache, and test the Admin Panel and frontend.

Memcached Persistent ID allows compatible PHP-FPM environments to reuse the same connection between requests. Leave it empty unless your host specifically recommends a value.

Set up Redis

Redis is another external in-memory service and is often the most flexible choice for a managed VPS because the same Redis installation can support both caching and background queues.

Redis cache configuration fields in TruCMS

Selecting Redis reveals the Redis host, port, authentication and database options.

  1. Create/enable a Redis service that the TruCMS server can reach.
  2. Enable compatible PHP Redis support for the site's PHP version.
  3. Collect the Redis Host, Port, and any required Username/Password.
  4. Choose a Redis database number for the cache. 0 is the normal default unless your server administrator has allocated another database.
  5. Select Redis, enter the values, save, and use Clear Cache.
  6. Browse the frontend and Admin Panel to confirm the connection works.

Using Redis for queues too?

The Queue Driver is configured under Queue & Background Jobs. Keep the queue name separate from the cache purpose and ensure a queue worker is running.

Response Cache

Enable Response Cache stores complete cacheable public responses, which can make repeat visits much faster. It is separate from the general Cache Driver above.

OptionWhat it changesGuidance
Enable Response CacheTurns complete-response caching on for public routes that TruCMS marks as cacheable.Use it on production sites after confirming dynamic pages such as checkout/account flows still behave as expected.
Add Cache HeadersAdds cache timing/age information to eligible responses.Useful when diagnosing whether a response is being cached.
Cache LifetimeHow long a cached response remains valid, in seconds.The default is 604800 seconds (7 days). Shorten it when public content changes frequently.
Clear CacheClears the application cache and response cache.Use after changing cache/storage behavior or when the site visibly serves stale content.

A safe way to change cache drivers

  1. Back up the site before changing server infrastructure on a live production installation.
  2. Prepare and test the target cache service/PHP extension first.
  3. Change the Cache Driver and save.
  4. Click Clear Cache.
  5. Test admin login, several public pages, Booking/TruCommerce pages if enabled, and any queue that also uses Redis.