distributed

command
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 9 Imported by: 0

README

Distributed Cache Example

Demonstrates a Redis-backed distributed cache using RedisStore.

What it shows

  • Connecting to Redis via the rueidis client
  • Creating a RedisStore with a key prefix for namespacing
  • Wrapping it in a type-safe Cache[Order] with a default TTL
  • Set, Get, Delete operations against Redis
  • TTL expiration behaviour

Prerequisites

A running Redis instance (default: localhost:6379).

# Start Redis with Docker
docker run --rm -p 6379:6379 redis:7-alpine

Override the address with the REDIS_ADDR environment variable:

REDIS_ADDR=redis.example.com:6379 go run ./examples/distributed/

Run

go run ./examples/distributed/

Documentation

Overview

Package main demonstrates a Redis-backed distributed cache.

Requires a running Redis instance. Set REDIS_ADDR to override the default "localhost:6379".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL