Skip to content

akluth/nyssrad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nyssrad

A small Redis-like in-memory store exposed through a REST API, written in Rust.

Getting Started

cargo run

By default, the server listens on 127.0.0.1:7379.

$env:NYSSRAD_ADDR = "0.0.0.0:7379"
cargo run

Direct REST Endpoints

curl -X PUT http://127.0.0.1:7379/v1/kv/name \
  -H "content-type: application/json" \
  -d '{"value":"Ada","ttl_seconds":60}'

curl http://127.0.0.1:7379/v1/kv/name
curl -X POST http://127.0.0.1:7379/v1/kv/name/incr -H "content-type: application/json" -d '{"by":2}'
curl -X DELETE http://127.0.0.1:7379/v1/kv/name

Redis-Style Command Endpoint

Common operations are also available through POST /v1/commands:

curl -X POST http://127.0.0.1:7379/v1/commands \
  -H "content-type: application/json" \
  -d '{"command":"set","args":["visits","1"],"ttl_seconds":30}'

curl -X POST http://127.0.0.1:7379/v1/commands \
  -H "content-type: application/json" \
  -d '{"command":"incr","args":["visits"]}'

Supported commands:

  • Strings: GET, SET, DEL, EXISTS, EXPIRE, TTL, INCR, DECR, MGET, MSET
  • Lists: LPUSH, RPUSH, LPOP, RPOP, LRANGE
  • Hashes: HSET, HGET, HGETALL, HDEL
  • Sets: SADD, SREM, SMEMBERS, SISMEMBER
  • Admin: DBSIZE, FLUSHDB

Notes

  • Data is intentionally kept in memory only.
  • TTL cleanup is lazy and happens when keys are accessed.
  • Values are JSON-compatible; the command endpoint treats arguments as strings.

About

A small Redis-like in-memory store exposed through a REST API, written in Rust.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages