# Shared dicts and queues

> A named dictionary and a named queue that your code and every container of your workspace can read and write.

Canonical page: https://klio.tech/docs/dicts-and-queues

## Shared dict

```python
from klio_compute import Map

scores = Map(name="scores")
scores["player-1"] = 1200
print(scores["player-1"])
```

`Map` works like a Python dictionary, is safe to use from many containers at once, and keeps its contents between runs. Values are serialized with cloudpickle.

## Shared queue

```python
from klio_compute import Queue

jobs = Queue(name="jobs")
jobs.put({"level": 3})
while not jobs.empty():
    print(jobs.pop())
```

`Queue` is a named queue that is safe to use from many containers at once: `put` adds an item, `pop` takes one, and it keeps its items between runs.
