Skip to main content
Winter Boot ships two lightweight in-process stores — a Key-Value store and a Queue store — that run as child processes alongside your Swoole workers. Every worker process on the same host connects to these stores over a local TCP socket, giving them a shared memory space with zero external infrastructure. The stores are intentionally node-local: they are fast because no network round-trip leaves the machine, but they do not replicate across hosts. For distributed, multi-node state use the winter-data-redis module instead.
Both stores are node-local. All Swoole worker processes on the same host share the same store instance, but two separate hosts each run their own independent stores. If you need cross-node shared state, see the Redis library.

Key-Value Store

The KV store provides a fast, typed key-value cache scoped by a domain string. It is used internally by the SharedKvCache bean and is available to any bean that autowires KvTemplate.

Enabling the KV Store

Add the following block to your application.yml. The store will not start unless port is a positive integer.
application.yml

Autowiring KvTemplate

Once the store is enabled, the framework registers a KvTemplate bean automatically. Inject it with #[Autowired]:
src/Service/SessionCacheService.php

KvTemplate API Reference

Shared KV Cache

The SharedKvCache bean is backed by this KV store. Enabling the store automatically makes SharedKvCache available to any class annotated with #[Cacheable], with no additional configuration required.

Queue Store

The Queue store provides a lightweight FIFO queue scoped by a queue name string. The framework uses it internally as the default backing store for #[Async] tasks and scheduled workers. You can also enqueue and dequeue your own messages directly via QueueSharedTemplate.

Enabling the Queue Store

application.yml

Autowiring QueueSharedTemplate

src/Service/NotificationDispatcher.php

QueueSharedTemplate API Reference

Async Task Queue

When #[EnableAsync] is active on your application class, Winter Boot automatically registers worker processes that consume from the internal async queue. The Queue store must be enabled for this to work:
application.yml
The Queue store is required for #[Async] tasks. If the port is not set (or is 0), the async worker processes will not start and async method calls will be silently dropped.

Running Both Stores Together

A typical application.yml that enables both stores side-by-side:
application.yml
Both stores are started as Swoole sub-processes before any HTTP workers boot, so they are always ready when your beans initialise. You can verify connectivity by calling $kvTemplate->ping() or $queue->ping() inside an #[OnApplicationReady] listener.
For production workloads that span multiple hosts — or that need persistence across restarts — replace the node-local stores with the winter-data-redis module. It provides Redis-backed implementations of both KvTemplate and the async task queue that work across any number of nodes.