example/client-side-caching/README.md
This example enables the built-in client-side cache on a standalone go-redis client. It demonstrates:
CSCStatsgo-redis uses Redis CLIENT TRACKING and RESP3 invalidation notifications to
keep the local cache synchronized. Invalidations are asynchronous, so the
example waits until the cached client observes the updated value.
CLIENT TRACKING supportFixed Username and Password values are supported.
The Redis address defaults to localhost:6379. Override it with REDIS_ADDR:
go run .
# or
REDIS_ADDR=localhost:6390 go run .
Expected output:
first read: hello
second read: hello
cache stats: 1 hit, 1 miss
after invalidation: hello again