Framework provides following out-of-box shared in-memory stores local to each node. Multiple processes can share it.
-
Key-Value Store
-
Queue Store
To enable KV store, update application.yml with following configuration.
winter:
kv:
port: 7880
address:
Framework provides KvTemplate as a bean autowired.
#[Autowired]
private KvTemplate $kvTemplate;
// Usage
$this->kvTemplate->put('domain-name', 'key', 'value');
$val = $this->kvTemplate->get('domain-name', 'key');
To enable Queue store, update application.yml with following configuration.
winter:
queue:
port: 7881
address:
Framework provides QueueSharedTemplate as a bean autowired.
#[Autowired]
private QueueSharedTemplate $queue;
// Usage
$this->queue->enqueue('queue-name', mixed $value);
$item = $this->queue->dequeue('queue-name');