v1.2.1-alpha
Getting Started
Client SDK's
Core Features
BranchDB is an in-memory key-value store built in C++, with support for TTL, set operations, authentication, and disk persistence. You can connect via a TCP client on port 1981 to start issuing commands.
Below is a quick overview of common BranchDB commands, what they do, and their syntax.
Command | Syntax | Description |
---|---|---|
SET | SET <key> <value> [EX <seconds>] | Sets a key to hold a string value, with an optional Time-to-Live (TTL) in seconds. |
GET | GET <key> | Retrieves the value of a key from the database. |
DEL | DEL <key> | Deletes a specified key from the database. |
EXISTS | EXISTS <key> | Checks for the existence of a key in the database, returning a boolean value. |
TTL | TTL <key> | Returns the remaining time to live (in seconds) for a key with an expiry set. |
EXPIRE | EXPIRE <key> <seconds> | Sets a new TTL for an existing key, overwriting any previous expiry. |
PERSIST | PERSIST <key> | Removes the TTL from a key, making it permanent. |
GETALL | GETALL | Returns all keys for the authenticated user's data partition. |
FLUSH | FLUSH | Deletes all keys for the authenticated user and compacts the log file. |
BranchDB allows you to store keys temporarily using TTL. You can attach an expiry time (in seconds) when setting a key. Once the time is up, the key vanishes — no manual deletion needed.
Terminal
> SET X 6 EX 10
> GET X
10
// After 10 Seconds
> GET X
Key Not found// Key 'X' Expired ( Deleted by Background Thread )