Skip to content

[Improvement] Wire the Pimcore cache pool to the Valkey container - #297

Open
berfinyuksel wants to merge 3 commits into
2026.xfrom
wire-valkey-cache
Open

berfinyuksel wants to merge 3 commits into
2026.xfrom
wire-valkey-cache

Conversation

@berfinyuksel

@berfinyuksel berfinyuksel commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Why

docker-compose.yaml started a Redis container, but nothing used it: the pimcore.cache.pool block in config/config.yaml was commented out, so a fresh install silently ran Pimcore's object cache on the database adapter (cache_items table). Core's CacheFallbackPass picks the DB adapter whenever no pool is defined; nothing reads REDIS_URL on its own.

Follow-up to the discussion on pimcore/platform-version#615: fix it at the source instead of documenting the gap. Companion PR for demo-enterprise: pimcore/demo-enterprise#549.

Changes

File Change
docker-compose.yaml redis → valkey (valkey/valkey:alpine), same command and commented-out Redis alternative as demo-enterprise, so both packages use the same cache service. Also fixes the old command, which passed --maxmemory 128mb as a single argument.
.env REDIS_URL=redis://valkey:6379 (same as demo-enterprise)
config/config.yaml pimcore.cache.pool enabled with provider: '%env(REDIS_URL)%'
config/packages/test/config.yaml cache.adapter.array for tests (same as pimcore/pimcore's CI test config): tests neither depend on the cache container nor share entries with the dev instance
src/Installer/SkeletonProfile.php RedisEnvVarDefinition so the installer validates the cache connection
.github/workflows/pimcore-skeleton.yml wait for valkey:6379 before running the installer
README.md mention Valkey and that the cache is pre-wired

Verification

  • YAML of all edited files parses; RedisEnvVarDefinition exists in v2026.2.14+ and on 2026.x.
  • provider: '%env(REDIS_URL)%' with redis_tag_aware is what paas-skeleton runs in production.
  • Not run locally (no Docker on my machine): the CI workflow does the full compose up → install → Codeception run and is the runtime check.
  • New CI step "Verify the Pimcore cache is served by Valkey": runs pimcore:cache:warming after the install (forced writes go through RedisTagAwareAdapter::doSave, including its eviction-policy check) and asserts valkey-cli DBSIZE > 0. Without it no CI step ever writes to the cache: CLI processes don't write the object cache by default, and a web request flushes its save queue after the response is sent.

Reviewer notes

  • With the pool enabled, REDIS_URL becomes mandatory wherever config.yaml is loaded: a project without a reachable Redis/Valkey now fails to boot instead of silently using the DB. Intended, but a behaviour change for anyone copying the template to a non-Docker host.
  • Sessions are out of scope (still PdoSessionHandler).

🤖 Generated with Claude Code

docker-compose.yaml started a Redis container, but nothing used it: the
pimcore.cache.pool block in config/config.yaml was commented out, so a fresh
install silently ran Pimcore's object cache on the database adapter
(cache_items table).

- docker-compose.yaml: replace the redis service with valkey (same image,
  command and commented-out Redis alternative as demo-enterprise) so both
  packages use the same cache service.
- .env: add REDIS_URL=redis://valkey:6379, like demo-enterprise.
- config/config.yaml: enable the pimcore.cache.pool block with
  provider '%env(REDIS_URL)%'.
- config/packages/test/config.yaml: use cache.adapter.array for tests (same
  as pimcore/pimcore's CI test config), so tests neither depend on the cache
  service nor share entries with the dev instance.
- SkeletonProfile: add RedisEnvVarDefinition so the installer validates the
  cache connection during installation.
- CI workflow: wait for valkey:6379 before running the installer.
- README: mention Valkey and that the cache is pre-wired.

Co-Authored-By: Claude <noreply@anthropic.com>
@berfinyuksel
berfinyuksel requested a review from mcop1 October 13, 2026 11:52
@berfinyuksel berfinyuksel added the Skip Milestone Check Exempts this PR from the mandatory milestone requirement label Oct 15, 2026
berfinyuksel and others added 2 commits October 15, 2026 12:19
CI failed in "Run codeception tests" with:
  Service ".pimcore.cache.pool.inner": The argument "1" doesn't exist in
  class "Symfony\Component\Cache\Adapter\ArrayAdapter".

Symfony merges pool options per pool name across config files, so in the
test environment the array-adapter override still carried the
provider '%env(REDIS_URL)%' from config/config.yaml. CachePoolPass maps
provider to constructor argument 0 and default_lifetime to argument 1,
but cache.adapter.array declares only one argument.

Setting provider to null makes both FrameworkExtension and CachePoolPass
treat the pool as having no provider (they check with isset), which puts
default_lifetime back at argument 0, the same shape as pimcore/pimcore's
CI test config.

Co-Authored-By: Claude <noreply@anthropic.com>
The existing workflow proves the pool compiles, the installer can connect,
and (via demo-enterprise) that reads work, but no step ever wrote to the
cache: CLI processes do not write the object cache by default, and a web
request flushes its save queue after the response is sent.

pimcore:cache:warming uses forced writes, which bypass the CLI gate and go
through RedisTagAwareAdapter::doSave, including its eviction-policy check.
A fresh install has a root document, asset folder and object folder, so
after warming, Valkey must hold keys; the step asserts DBSIZE > 0.

Co-Authored-By: Claude <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Test installation still validates Valkey connectivity despite using an in-memory cache.

1 open finding
What changed in this PR

Wires Pimcore’s object cache to Valkey instead of the database fallback.

Changes:

  • Enables the cache pool through REDIS_URL and adds installer validation.
  • Uses an in-memory cache for tests.
  • Adds CI readiness and cache-write checks, plus setup documentation.
File Description
src/​Installer/​SkeletonProfile.php Adds Redis connection validation.
README.md Documents the preconfigured Valkey cache.
docker-compose.yaml Replaces Redis with Valkey and fixes command arguments.
config/​packages/​test/​config.yaml Configures an isolated in-memory cache.
config/​config.yaml Enables the Redis-compatible cache pool.
.github/​workflows/​pimcore-skeleton.yml Waits for Valkey and verifies cache writes.
.env Sets the Valkey connection URL.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

new AmqpMessengerEnvVarDefinition(),
new MercureEnvVarDefinition(),
new ProductRegistrationEnvVarDefinition(),
new RedisEnvVarDefinition(),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Milestone Check Exempts this PR from the mandatory milestone requirement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants