MIRAY CLI - Interactive command-line interface for MIRAY server.
npm install -g miray-cliAfter installation, you can run:
miray-clinpm install miray-cliThen run with:
npx miray-cli# Default (localhost:7779)
miray-cli
# Custom host and port
miray-cli --host localhost --port 7779
# Short flags
miray-cli -h localhost -p 7779$ miray-cli
MIRAY CLI - Memory In-memory Rapid Async Yield
Connecting to localhost:7779...
Connected!
> PING
PONG
> PUSH user:123 "John Doe" 5m
OK
> GET user:123
"John Doe"
> TTL user:123
298
> KEYS user:*
1) "user:123"
> INFO
MIRAY Server v2 (WAL + Binary)
# Storage
keys: 1
memory: ~100 bytes
reads: 1
writes: 1
...
> FLUSH
OK
> exit
Goodbye!PING- Test server connectivityINFO- Get server information and statistics
PUSH key value [ttl]- Store a key-value pair- TTL formats:
30s,5m,2h,1d
- TTL formats:
GET key- Retrieve a valueREMOVE key- Delete a key
KEYS pattern- List keys matching pattern*- All keysuser:*- Keys starting with "user:"*:active- Keys ending with ":active"
TTL key- Get remaining time-to-live in seconds- Returns: seconds remaining,
-1(no expiration), or-2(key not found)
- Returns: seconds remaining,
FLUSH- Clear all data (use with caution!)
> PUSH user:1 '{"name":"John","age":30}' 1h
OK
> GET user:1
{"name":"John","age":30}> PUSH session:abc '{"userId":123,"token":"xyz"}' 30m
OK
> TTL session:abc
1799
> GET session:abc
{"userId":123,"token":"xyz"}> PUSH cache:api:users '[{"id":1,"name":"John"}]' 5m
OK
> KEYS cache:*
1) "cache:api:users"
> REMOVE cache:api:users
1> PUSH user:1 "John"
OK
> PUSH user:2 "Jane"
OK
> PUSH product:1 "Laptop"
OK
> KEYS *
1) "user:1"
2) "user:2"
3) "product:1"
> KEYS user:*
1) "user:1"
2) "user:2"--host,-h: Server host (default:localhost)--port,-p: Server port (default:7779)
To exit the CLI:
- Type
exitorquit - Press
Ctrl+C - Press
Ctrl+D
- 📝 Interactive REPL
- 🎨 Syntax highlighting for responses
- ⌨️ Command history (use arrow keys)
- 🔄 Auto-reconnect on connection loss
- 📊 Server statistics via INFO command
-
Use Quotes for Values with Spaces
> PUSH key "value with spaces"
-
JSON Data
> PUSH user '{"name":"John","active":true}'
-
Check Before Flush
> INFO keys: 1000 > FLUSH OK
-
TTL Monitoring
> PUSH temp "data" 10s OK > TTL temp 9 # Wait a bit... > TTL temp -2
- miray-server - TCP server
- miray-client - Node.js SDK
MIT