Skip to content

tinfoil-knight/tiny-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiny-redis

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.

Getting Started

Pre-requisites

Running locally

make run

Note: The examples assume that the TCP server is running on localhost at port 8001.

Usage

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

Creating a build

make build

Running tests

make test

Author

Acknowledgements

LICENSE

  • License for tiny-redis: MIT
  • The Redis trademark is owned by Redis Labs.

Appendix

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

About

In-memory key-value data store

Topics

Resources

License

Stars

Watchers

Forks