redis

command
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Example: Redis provider.

Models the runtime config of a checkout service: log level, request timeout, a rate limit, a maintenance feature flag, a database connection struct, and a list of allowed CORS origins. The Redis provider watches every key under "checkout/" with a single keyspace-notification subscription, so updates arrive as events rather than by polling.

Run it end to end:

docker compose up -d
docker compose exec redis redis-cli SET checkout/log_level info
docker compose exec redis redis-cli SET checkout/request_timeout 30s
docker compose exec redis redis-cli SET checkout/rate_limit_rps 100
docker compose exec redis redis-cli SET checkout/maintenance_mode false
docker compose exec redis redis-cli SET checkout/database '{"host":"db.internal","port":5432,"max_open_conns":20}'
docker compose exec redis redis-cli SET checkout/allowed_origins '["https://app.example.com"]'
go run main.go

Then change a value and watch the app log the event:

docker compose exec redis redis-cli SET checkout/rate_limit_rps 500
docker compose exec redis redis-cli SET checkout/maintenance_mode true

Jump to

Keyboard shortcuts

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