Skip to content

Latest commit

 

History

History
executable file
·
54 lines (36 loc) · 1.04 KB

local_store.md

File metadata and controls

executable file
·
54 lines (36 loc) · 1.04 KB

Shared In-Memory Stores

Framework provides following out-of-box shared in-memory stores local to each node. Multiple processes can share it.

  1. Key-Value Store

  2. Queue Store

1. Key-Value(KV) 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');

2. Queue Store

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');