Skip to content

chammaaomar/make-your-own-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyRedis

This is my Python solution to the "Build Your Own Redis" Challenge.

Note: Head over to codecrafters.io to signup for early access.

Usage

  1. Ensure you have python (3.7) or higher installed locally
  2. Run ./spawn_redis_server.sh to run the Redis server, which is implemented in app/.
  3. The Redis server will be launched and bound to port 6379, the default Redis port. You can speak to it using the redis-cli. You can compile the redis server + cli directly from source or install on macOS via homebrew
brew install redis

or use your favorite linux package manager. Simply start up the cli by typing redis-cli in the terminal.

TODO

  • Currently querying via telnet doesn't work, as far as I can tell, because if you try to write a command in accordance with RESP, for exmaple set redis awesome, which is

*2\r\n$3\r\nset\r\n$5\r\nredis\r\n\$7\r\nawesome\r\n

telnet just escapes all the CRLF \r\n and thus the parser doesn't work correctly.

  • handling concurrent clients is implemented via threads, whereas real Redis implementation is single-threaded and based on event-loops. Likewise, key expiry uses a sleeping thread, that only wakes up after the Time-To-Live (TTL) has passed. There is a more elegant way.
  • add docstrings
  • Implement more data types and commands

About

Making my own Redis server with codecrafers.io in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •