Service: DiceDB - EyevinnOSC/community GitHub Wiki
DiceDB (serviceId dicedb-dice) is an open source, in-memory database that is wire-compatible with Redis and adds reactive query support. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance. License: AGPL-3.0.
- Act as a Redis-compatible in-memory store: any Redis client works, since DiceDB speaks the Redis Serialisation Protocol (RESP).
- Let clients subscribe to SQL-like queries with
QWATCHand receive a push notification whenever the result changes, without polling (QUNWATCHunsubscribes). - Fit leaderboards, live dashboards, multiplayer game state and other workloads where clients must react immediately to data changes.
Create the instance with create-service-instance using serviceId: "dicedb-dice". The name must be alphanumeric and at most 20 characters. DiceDB has no dependencies on other OSC services and no other options.
{ "name": "myleaderboard" }Wait with wait-for-service-ready, then use describe-service-instance to read the host and port. OSC CLI form: osc create dicedb-dice myleaderboard.
| Option | Required | Type | Meaning |
|---|---|---|---|
| name | Yes | string | Name of the instance. Letters, digits and underscore only, at most 20 characters. |
DiceDB has no other options.
Connect with redis-cli:
redis-cli -h <host> -p <port>Basic key-value operations are identical to Redis:
SET player:alice 1200
GET player:alice
INCR player:alice
Reactive queries use a persistent connection. Subscribe to the top 3 players by score:
QWATCH "SELECT $key, $value WHERE $key LIKE 'player:*' ORDER BY $value DESC LIMIT 3"
Every INCR player:alice or SET player:bob 1500 from any other client then pushes an update to all subscribers of that query.
Node.js example for standard commands (for reactive queries, use a second persistent connection via redis-cli or the DiceDB SDK):
import { createClient } from 'redis';
const client = createClient({ url: 'redis://<host>:<port>' });
await client.connect();
await client.set('player:alice', 1200);
const score = await client.get('player:alice');
console.log(score); // "1200"