Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

sevenx_valkey_cache: Redis and Valkey cache backend

This page is for administrators who want faster pages or run several web servers. sevenx_valkey_cache stores Exponential's caches in Redis or Valkey instead of files. It replaces disk storage for:

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/features/6.0/extensions/sevenx_valkey_cache.md

On this page

sevenx_valkey_cache: Redis and Valkey cache backend

This page is for administrators who want faster pages or run several web servers. sevenx_valkey_cache stores Exponential's caches in Redis or Valkey instead of files. It replaces disk storage for:

  • {valkey-block ...} template blocks (a cache block that lives in Redis or Valkey);
  • the content view cache (content/view full view);
  • the compiled INI cache (eZINI arrays). This removes the per-request touches of var/cache/ini/*.php and makes INI caches safe for clusters.

Entries have TTL based expiry, generation locks (no cache stampede) and reverse node and subtree indexes, so publishing content purges exactly the entries it affects. It first shipped on 20 July 2026 (1.0.0); 1.0.1 documented 6.0.15 as the required platform.

Requirements

  • Exponential 6.0.15 or later, whose kernel calls the extension's hooks (see "What the kernel does").
  • The PHP redis extension (or igbinary).
  • A reachable Redis or Valkey server.

Set it up

  1. Install and activate the extension:
composer require se7enxweb/sevenx_valkey_cache
# settings/override/site.ini.append.php
[ExtensionSettings]
ActiveExtensions[]=sevenx_valkey_cache
  1. Configure the connection in settings/override/valkeycache.ini.append.php:
[ValkeyCacheSettings]
Host=127.0.0.1
Port=6379
Database=0
KeyPrefix=sevenx_valkey_cache:
InstallationHash=auto
DefaultTTL=3600
LockTTL=30
Persistent=disabled
LocalCache=enabled
IniCache=enabled
  1. Regenerate autoloads and clear the caches:
php bin/php/ezpgenerateautoloads.php -e
php bin/php/ezcache.php --clear-all --allow-root-user
  1. Check that it works: call a page twice, then list the keys:
redis-cli --scan --pattern 'sevenx_valkey_cache:*'

Keys are listed. With eZINI debug on, a notice says Loading Redis cache '...' for file '...' when INI data come from the server.

Settings

All keys are in valkeycache.ini, block ValkeyCacheSettings; set them in settings/override.

KeyDefaultMeaning
Host, Port, Database127.0.0.1, 6379, 0Server
KeyPrefixsevenx_valkey_cache:Prefix of every key. Keep it unique per installation when several sites share one server
InstallationHashautoA hash of the database name, site name, filesystem root and host name; use a fixed string to share a cache between servers
DefaultTTL3600Seconds, when no expiry is given
LockTTL30Seconds a generation lock lives if the generating process crashes
Persistentdisabledpconnect; use with care when several databases share a php-fpm pool
LocalCacheenabledA per-request copy of retrieved entries, saving round trips. Disable only when debugging cache consistency
IniCacheenabledCompiled INI arrays in Redis/Valkey. Needs Exponential 6.0.15

Use it in templates

{valkey-block expiry=3600 subtree_expiry=$node.node_id keys=array( 'my-block', $node.node_id )}
    ... expensive template logic ...
{/valkey-block}
ParameterMeaning
expiryTTL in seconds (default 7200)
subtree_expiryNode id as a subtree dependency: any change under it purges the block
node_expiryNode id as a node dependency
keysMore key components (array or scalar)
lockGeneration locks against stampedes (default true)
ignore_content_expiryIgnore the global template-block-cache and global-template-block-cache timestamps

From code: sevenxValkeyCacheBlock::instance() offers put( $key, $content, $ttl ), get( $key ), purge( $key ) and flush(). The class sevenxValkeyCacheHandler is registered as ContentSettings.StaticCacheHandler and purges the view and block entries indexed by the affected node ids and their ancestors when content changes.

Clear everything from the shell

bin/php/ezvalkeycacheclear.php (added 20 July 2026) clears all caches through the same PHP cache handlers the admin uses, flushes the Redis/Valkey keys the extension wrote, and regenerates the extension autoloads, passing --exclude for every extension directory that is not in ActiveExtensions[], so disabled-but-present extensions disappear from var/autoload/ezp_extension.php and from class_exists() checks. It is the fallback when the admin's Clear all caches cannot clean up after an extension is removed or a cache backend is disabled.

Faster INI cache (1.0.2, 30 July 2026)

The compiled INI cache is one Redis hash keyed by the file's MD5 (HGET, HSET, HDEL) instead of one key per file. The previous design scanned the whole keyspace (SCAN and MGET) on every request, which is expensive on a busy server; the request-scoped in-memory cache stays and is filled on demand.

What the kernel does (hooks)

The kernel calls the extension only when its classes exist (class_exists() is checked first), so a site without the extension pays nothing. Hooks added on 20 July 2026 (commits fa17892025, 6ef123636c, 908994bb03):

WhereFileBehaviour with the extension enabled
Content view cachekernel/private/classes/views/content/view.php (entry kernel/content/view.php)The page's entry is read with sevenxValkeyCacheBlock::get(); on a miss the page is generated and stored with put() for 3600 seconds, keyed by the node id. The 3600 seconds are set in that file, not in an INI file.
Pages that must not be cachedsame classA result that says no_cache is generated every time and never stored (26 July 2026 fix).
Compiled INI cachelib/ezutils/classes/ezini.phpsevenxValkeyINICache::instance()->isEnabled() is asked first; compiled INI data are loaded from or saved to the server instead of var/cache/ini/. Clearing the INI cache deletes the entries.

On a miss or when disabled, the kernel falls back to the cluster file handler and the files, exactly as before.

Limits

  • Entries live in memory: size the server for the number of pages and siteaccesses, and set an eviction policy.
  • A server outage turns into cache misses; the extension decides how errors are reported.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x