Skip to content

reillyjodonnell/zig-redis-clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Redis clone with zig

Screen.Recording.2024-01-20.at.6.47.48.PM.mov

How Redis works

  • "In memory db" means that it's literally just a hash map that reads/ updates/ deletes values at run time as they come in

How is this implemented?

  1. Create a TCP server bounded to a specific port (and address) and listen for incoming stream
  2. convert stream into a string
  3. Parse string into tokens
  4. Interact with cache through generated tokens to update it
  5. return a response to the stream

How to run

zig run main.zig

then interact with database with netcat i.e. nc 127.0.0.1 8080

Common errors:

.ADDRINUSE => return error.AddressInUse, This means the port & IP you've got is being used. You can either:

  1. Choose a different port
  2. Kill the process running at that port:
    • lsof -i :8080
    • kill 1234 (or whatever the id from above is)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages