Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A lightweight, in-memory Redis-clone key-value storage written in Go. Supports atomic operations, TTLs, and concurrency-safe access.

Requirements:

  • Go >= 1.25.1

Run:

go run ./cmd/server/

Features

  • Core Commands

    • SET – store a key/value with optional NX/XX and TTL (EX/PX)
    • GET – retrieve a key, respecting TTL
    • DEL – delete a key
    • EXPIRE – set TTL in seconds with optional NX/XX
    • TTL – get remaining TTL in seconds
    • PTTL – get remaining TTL in milliseconds
    • PERSIST – remove TTL from a key
    • INCR – atomically increment an integer value
    • DECR – atomically decrement an integer value
    • INCRBY – atomically increment an integer value by a given amount
    • DECRBY – atomically decrements an integer value by a given amount
    • PING – server liveness check
  • TTL Handling

    • Supports EX (seconds) and PX (milliseconds)
    • Immediate deletion when TTL ≤ 0
    • Background janitor cleans expired keys
    • Lazy expiration ensures all commands see correct state
  • Concurrency Safe

    • All operations protected by a mutex
    • Atomic reads and writes
  • RESP Protocol Ready

    • Designed to integrate with RESP handlers for network communication

    [!NOTE] It does not use bufio.Reader for parsing. Custom parser has been implemented to prevent memory exhaustion attacks, and for better robustness.

  • TODOs:

  • Having a better logger

  • Seperate package for the Server

  • New Data Types: Sets, Hashes, and JŚON.

  • Sharding

Releases

Packages

Used by

Contributors

Languages