This repo contains an API using Go that incorporates an embedded cache capable of scaling safely to any specified number of replicas.
The use of a embedded cache alongside change data capture (CDC) invalidation is a powerful technique offers a robust method to ensure our high-performance cache remains synchronized with its primary data source.
In this pattern, we'll use the following components:
- Postgres as the primary database.
- Debezium to capture changes in Postgres and push to Redis Streams.
- Redis Streams to effectively handle and transmit change events.
- Ristretto as an in-memory caching solution in Go.
- Go as the primary language for implementing the service.
- Golang 1.21.3
- Go Migrate
go mod tidy
This will setup the db and services:
make restart
This will run the go application:
go run main.go