The opinionated Redis framework for Go developers who prioritize acceleration, sustainability, and high-performance downstreaming.
go get github.com/arielfikru/gibrun
app := gibrun.New(gibrun.Config{
Addr: "localhost:6379",
})
// Store data with auto JSON marshalling
app.Gib(ctx, "user:123").
Value(userData).
TTL(5 * time.Minute).
Exec()
// Retrieve with auto unmarshalling
found, _ := app.Run(ctx, "user:123").Bind(&result)
Everything you need to accelerate your Redis operations
Automatically transforms raw Go structs into JSON when storing, and back when retrieving. No more manual marshalling.
Readable syntax that's healthy for your codebase. Prevents performance stunting with clean, fluent interfaces.
Strong distributed lock mechanism. Prevents race conditions across goroutines and microservices.
Generic type support for precise data retrieval. Data goes directly to the right destination.
Native Redis Cluster support with automatic data migration across regions and shards.
Built-in token bucket rate limiter with HTTP middleware for fair API request distribution.
go get github.com/arielfikru/gibrun
import "github.com/arielfikru/gibrun"
app := gibrun.New(gibrun.Config{Addr: "localhost:6379"})
Master the framework with just three concepts
Use .Gib() to store data in Redis. Structs are automatically marshalled to JSON.
.Value() - Set the data to store.TTL() - Set expiration time.Exec() - Execute the operationtype Program struct {
Name string `json:"name"`
Budget int64 `json:"budget"`
}
data := Program{
Name: "Free Lunch",
Budget: 400000000000,
}
err := app.Gib(ctx, "program:priority").
Value(data).
TTL(5 * time.Minute).
Exec()
Use .Run() to fetch data from Redis. Automatically unmarshals to your target
type.
.Bind(&ptr) - Unmarshal to struct.Raw() - Get raw string value.Bytes() - Get raw bytesvar result Program
found, err := app.Run(ctx, "program:priority").
Bind(&result)
if found {
fmt.Printf("Program: %s\n", result.Name)
fmt.Printf("Budget: %d\n", result.Budget)
} else {
fmt.Println("Data not found")
}
Use .Sprint() for high-speed counter operations.
.Incr() - Increment by 1.IncrBy(n) - Increment by n.Decr() - Decrement by 1// Increment visitor count
count, _ := app.Sprint(ctx, "counter:visitors").
Incr()
fmt.Printf("Total visitors: %d\n", count)
// Increment score by 100
score, _ := app.Sprint(ctx, "counter:score").
IncrBy(100)
Seamlessly integrates with PraboGo's hexagonal architecture
Gib.run is designed to work as an outbound adapter in PraboGo projects. Use it for caching, rate limiting, and session management.
// PraboGo Hexagonal Architecture
type UserCacheAdapter struct {
client *gibrun.Client
}
func (a *UserCacheAdapter) Set(
ctx context.Context,
user *User,
) error {
return a.client.Gib(ctx, "user:"+user.ID).
Value(user).
TTL(time.Hour).
Exec()
}
func (a *UserCacheAdapter) Get(
ctx context.Context,
id string,
) (*User, error) {
var user User
found, err := a.client.Run(ctx, "user:"+id).
Bind(&user)
if !found { return nil, nil }
return &user, err
}