Skip to content

A sleek, Golang-powered learning adventure inspired by Redis

License

Notifications You must be signed in to change notification settings

ahmedash95/pedis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pedis

A sleek, Golang-powered learning adventure inspired by Redis

What is Pedis?

Pedis is a Redis clone written in Golang. It is a learning project for me to learn Redis protocol. It is not intended to be a production-ready Redis clone.

Build

Pedis does not have any external dependencies. To build it, simply run:

$ go build -o pedis-server && ./pedis-server

Usage

  • Initialize a Pedis server
package main

import (
	"ahmedash95/pedis/pedis"
	"fmt"
)

func main() {
	fmt.Println("Listening on port 6379")

	config := &pedis.Config{
		EnableAof: true,
	} // to enable AOF persistence or set config to nil

	server := pedis.NewServer(config)
	server.ListenAndServe("0.0.0.0:6379")
}
  • Connect to the server using a Redis client
$ redis-cli -p 6379

Supported Commands

  • GET
  • SET
  • DEL
  • EXISTS
  • EXPIRE
  • TTL
  • HSET
  • HGET
  • HGETALL
  • HDEL
  • HLEN
  • HKEYS
  • HVALS

Persistence

At the moment, Pedis supports AOF persistence. It is disable by default. To enabled it, set EnableAof to true in the config. the policy for now is to append to the AOF file every second.

Benchmarks

With no disk persistence

go run main.go
$ redis-benchmark -p 6379 -n 100000 -c 100 -t set,get

SET: 411761.19 requests per second
GET: 476640.00 requests per second

License

MIT

About

A sleek, Golang-powered learning adventure inspired by Redis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages