tiny-redis intends to be a rough implementation of the in-memory data store: Redis.
Note:
- The parser implements a subset of RESP3 without the Attribute, Push and Streamed data types.
- The project itself implements a subset of commands as specified in redis-doc.
make run
Note: The examples assume that the TCP server is running on localhost at port 8001.
You can run commands through netcat following the Redis protocol:
echo -e '*1\r\n$4\r\nPING\r\n' | nc localhost 8001
Or you can start a redis client using the redis-cli: redis-cli -p 8001
and then use it in Interactive mode.
127.0.0.1:8001> SET hello 3
OK
make build
make test
- Kunal Kundu @tinfoil-knight
- Exotel for their tech-challenge which gave me the idea to build this.
- License for tiny-redis: MIT
- The Redis trademark is owned by Redis Labs.
A. List of Allowed Commands
- Connection:
PING
,ECHO
- Keys:
DEL
,EXISTS
,COPY [REPLACE]
- Strings:
GET
,SET [NX|XX] [GET]
,GETDEL
,INCR
,DECR
,INCRBY
,DECRBY
,APPEND
,GETRANGE
,STRLEN
,SETRANGE
,MGET
,MSET
,MSETNX
,GETBIT
- Server:
SAVE
Note: Some commands may not support all options available in Redis 6. All available options have been documented above.
B. Allowed Configuration Parameters
Flag | Explanation | Default Value |
---|---|---|
port | TCP Port | 8001 |
bind | IP or Hostname | [::] |
Note: Currently, configuration is only supported through command line flags. Eg:
go run server.go -p 6379