Skip to content

Releases: l00pss/redkit

v.1.2.0

29 Dec 19:34

Choose a tag to compare

RedKit v1.2.0

New Features

Middleware Chain

server.UseFunc(func(conn *redkit.Connection, cmd *redkit.Command, next redkit.CommandHandler) redkit.RedisValue {
    start := time.Now()
    result := next.Handle(conn, cmd)
    log.Printf("%s took %v", cmd.Name, time.Since(start))
    return result
})

Server Configuration

config := redkit.DefaultServerConfig()
config.Logger = redkit.NewDefaultLogger(nil, redkit.LogLevelInfo)
server := redkit.NewServerWithConfig(config)

Structured Logging
Logger interface with Debug, Info, Warn, Error levels. Connection close errors now logged at Debug level instead of Error.

Changes

  • Middleware chain pattern with before/after hooks
  • ServerConfig struct for advanced setup (address, timeouts, max connections, logger)
  • Logger interface for custom logging implementations
  • Better connection lifecycle handling

No breaking changes. NewServer() still works as before

// Old way (still works)
server := redkit.NewServer(":6379")

// New way with config
config := redkit.DefaultServerConfig()
config.Address = ":6379"
config.Logger = redkit.NewDefaultLogger(nil, redkit.LogLevelDebug)
server := redkit.NewServerWithConfig(config)

Example Usage

Logging Middleware

server.UseFunc(func(conn *redkit.Connection, cmd *redkit.Command, next redkit.CommandHandler) redkit.RedisValue {
    log.Printf("[LOG] Command: %s from %s", cmd.Name, conn.RemoteAddr())
    result := next.Handle(conn, cmd)
    log.Printf("[LOG] Result: %v", result.Type)
    return result
})

Rate Limiting Middleware

var commandCounts sync.Map

server.UseFunc(func(conn *redkit.Connection, cmd *redkit.Command, next redkit.CommandHandler) redkit.RedisValue {
    val, _ := commandCounts.LoadOrStore(conn, 0)
    count := val.(int)
    
    if count >= 100 {
        return redkit.RedisValue{
            Type: redkit.ErrorReply,
            Str:  "ERR rate limit exceeded",
        }
    }
    
    commandCounts.Store(conn, count+1)
    return next.Handle(conn, cmd)
})

Full Diff: v1.1.0...v1.2.0

v1.1.0

25 Dec 07:06

Choose a tag to compare

RedKit v1.1.0 - Enhanced Testing & Redis Compatibility

New Features

  • Official Redis Client Testing: Complete test suite using github.com/redis/go-redis/v9
  • Performance Benchmarks: Detailed benchmarks showing ~14µs per operation
  • Advanced Redis Commands: Full support for MSET, MGET, INCR, DECR, EXPIRE, TTL, EXISTS, TYPE, KEYS

Improvements

  • Enhanced Documentation: Complete API reference and usage examples
  • Production Ready: Comprehensive production considerations and best practices

Testing Enhancements

  • Concurrent Operations: Thread-safety tests with 20+ goroutines
  • Stress Testing: High-volume operations (10,000+ keys)
  • Real-world Scenarios: Integration tests with actual Redis clients
  • Performance Validation: Benchmark tests for all major operations

Technical Improvements

  • Redis Protocol Compliance: 100% compatibility with Redis RESP protocol
  • Memory Optimization: Efficient memory usage and garbage collection
  • Connection Pooling: Better support for high-concurrency scenarios
  • TLS Support: Enhanced security with configurable TLS settings

What's Next

  • Lua scripting support

Full Changelog: v1.0.0...v1.1.0

v1.0.0

24 Dec 18:42

Choose a tag to compare

RedKit v1.0.0 Release

We're excited to announce the first stable release of RedKit - a high-performance Redis-compatible server implementation written in Go!

What's New in v1.0.0

  • Full Redis Protocol Compatibility - Compatible with standard Redis clients
  • High Performance - Built with Go's concurrency model for optimal performance
  • Connection State Management - Robust connection handling with proper state management
  • Comprehensive Testing - Thoroughly tested with real Redis clients
  • Production Ready - Stable API and battle-tested codebase

Key Features

  • Redis RESP protocol implementation
  • Thread-safe operations
  • Memory-efficient data structures
  • Extensive test coverage
  • Easy integration with existing Redis tooling

Installation

go get github.com/l00pss/redkit@v1.0.0