8000 GitHub - TommasoAmici/redis-clone: A Redis compliant server written in Go
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

TommasoAmici/redis-clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8000
 
 
 
 
 
 
 
 

Repository files navigation

Redis clone written in Go

I wrote this as a learning exercise. It's a Redis compliant server written in Go. I plan on implementing all functions available in Redis v1.

You can test it with redis-cli or telnet, for example:

make build
make run

redis-cli -p 6380 set 1 234
# OK
redis-cli -p 6380 get 1
# "234"

Implemented commands

This is the list of commands that were available in Redis v1.

  • AUTH
  • BGREWRITEAOF
  • BGSAVE
  • DBSIZE
  • DEBUG
  • DECR
  • DECRBY
  • DEL
  • ECHO
  • EXISTS
  • EXPIRE
  • FLUSHALL
  • FLUSHDB
  • GET
  • GETSET
  • INCR
  • INCRBY
  • INFO
  • KEYS
  • LASTSAVE
  • LINDEX
  • LLEN
  • LPOP
  • LPUSH
  • LRANGE
  • LREM
  • LSET
  • LTRIM
  • MGET
  • MONITOR
  • MOVE
  • PING
  • QUIT
  • RANDOMKEY
  • RENAME
  • RENAMENX
  • RPOP
  • RPUSH
  • SADD
  • SAVE
  • SCARD
  • SDIFF
  • SDIFFSTORE
  • SELECT
  • SET
  • SETNX
  • SHUTDOWN
  • SINTER
  • SINTERSTORE
  • SISMEMBER
  • SLAVEOF
  • SMEMBERS
  • SMOVE
  • SORT
  • SPOP
  • SRANDMEMBER
  • SREM
  • SUBSTR
  • SUNION
  • SUNIONSTORE
  • SYNC
  • TTL
  • TYPE

Benchmarks

I used hyperfine to figure out if my implementation is in line with Redis. I haven't actually looked at their source code as I didn't want to be influenced by it when coming up with my own implementation, as that would defeat any learning objective I had.

Benchmark 1: redis-cli -p 6380 set 2 abcdefghijklmnopqrstuvwxyz

Time (mean ± σ):       5.8 ms ±   0.4 ms    [User: 1.9 ms, System: 1.2 ms]
Range (min … max):     4.9 ms …   7.9 ms    473 runs

Benchmark 2: redis-cli 2 abcdefghijklmnopqrstuvwxyz

Time (mean ± σ):       5.9 ms ±   0.5 ms    [User: 1.9 ms, System: 1.2 ms]
Range (min … max):     5.0 ms …  10.0 ms    462 runs

Summary redis-cli -p 6380 set 2 abcdefghijklmnopqrstuvwxyz ran 1.02 ± 0.12 times faster than redis-cli 2 abcdefghijklmnopqrstuvwxyz

About

A Redis compliant server written in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0