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 theSharedKvCache bean and is available to any bean that autowires KvTemplate.
Enabling the KV Store
Add the following block to yourapplication.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
TheSharedKvCache 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 typicalapplication.yml that enables both stores side-by-side:
application.yml
$kvTemplate->ping() or $queue->ping() inside an #[OnApplicationReady] listener.