Skip to content

Maniktherana/godbase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Redis

Godbase

A drop-in replacement for redis written in Go

Table of Contents

Introduction

Godbase is a blazingly fast drop-in replacement for redis, built with golang.

It's a fun project that i started to learn more about redis and golang, taking help from this fantastic guide by ahmedash95. This project builds upon the concepts in this guide and adds features such as TTL options for the SET command.

The project is still in its early stages and is not recommended for production use. It's a fun project to learn more about redis and golang.

Feature parity

Feature Redis Godbase
In-memory key-value store
Strings
Persistence
Hashes
TTL
Lists
Sets
Sorted sets
Streams
HyperLogLogs
Bitmaps
Pub/Sub
Transactions

Available commands

The following commands are supported by Godbase as of now:

MISC

PING

Strings

SET GET

Hashes

HSET HGET HGETALL

The SET Command

SET key value [NX | XX] [GET] [EX seconds | PX milliseconds | KEEPTTL]

The SET command supports the following options:

  • EX seconds -- Set the specified expire time, in seconds (a positive integer).
  • PX milliseconds -- Set the specified expire time, in milliseconds (a positive integer).
  • NX -- Only set the key if it does not already exist.
  • XX -- Only set the key if it already exists.
  • KEEPTTL -- Retain the time to live associated with the key.
  • GET -- Return the old string stored at key, or nil if key did not exist. An error is returned and SET aborted if the value stored at key is not a string.

Time complexity: O(1)

Installation

Clone this repository and use the makefile to build or run the binary.

git clone https://github.com/Maniktherana/godbase.git
make build

Compatibility

Godbase is compatible with existing redis clients. You can use the redis-cli to interact with godbase for the supported commands.

redis-cli -h localhost -p 6379
localhost:6379> set hello world
OK
localhost:6379> get hello
world
localhost:6379> set god man
OK
localhost:6379> set god base xx
OK
localhost:6379> get god
base

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A drop-in replacement for redis written in Go

Topics

Resources

License

Stars

Watchers

Forks