These are the building blocks of working with Prithvi. Lightweight and efficient, they mirror classic key-value store operations.
- SET <key> <value>: Stores the value under the given key.
- GET <key>: Fetches the current value for the key.
- DEL <key>: Removes the key (and its value) from the store.
Terminal
1 SET language Sanskrit
2 GET language
Sanskrit
3 DEL language
4 GET language
(null)
Learn more:
Prithvi supports list operations similar to Redis. You can push values to either end and pop them from either side as well.
- LPUSH <key> <value>: Pushes to the *left* of the list (start).
- RPUSH <key> <value>: Pushes to the *right* of the list (end).
- LPOP <key>: Removes and returns the *first* element.
- RPOP <key>: Removes and returns the *last* element.
Terminal
1 LPUSH tasks Code
2 RPUSH tasks Sleep
3 RPUSH tasks Repeat
4 LPOP tasks
Code
5 RPOP tasks
Repeat
Learn more:
Prithvi supports native Set operations — useful for collections of unique elements. Elements are stored unordered and without duplicates.
- SADD <key> <element>: Adds an element to the set under the given key.
- SMEMBERS <key>: Lists all unique elements in the set.
- SREM <key> <element>: Removes an element from the set.
Terminal
1 SADD fruits Mango
2 SADD fruits Banana
3 SADD fruits Mango
4 SMEMBERS fruits
Banana
Mango
5 SREM fruits Mango
6 SMEMBERS fruits
Banana
Learn more:
Prithvi provides several utility commands to inspect, manage, and interact with the key-value store effectively.
- GETLIST <key>: Fetches all list elements stored under a key.
- KEYS: Displays all keys with their TTL (if any).
- EXISTS <key>: Checks whether a key is present.
- FLUSH: Prompts for confirmation before clearing the store.
- FLUSH FALL: Immediately clears all keys.
- HELP: Lists available commands with syntax.
- QUIT: Gracefully closes the client session.
Terminal
1 GETLIST fruits
Banana
Papaya
2 KEYS
fruits - TTL: 120s
name - TTL: none
3 EXISTS name
true
4 FLUSH
Are you sure? Type FLUSH FALL to confirm.
5 FLUSH FALL
Store wiped.
6 HELP
GET <key>
SET <key> <value>
...
FLUSH FALL
QUIT
7 QUIT
Goodbye.