Showcasing Different Cache Invalidation Strategies (Time, Write-Through, Least Recently Used, Event, Version, Invalidate-On-Change, Distributed Caching)
- Time-based Expiration: Using
go-cache
to expire items after a certain duration (time.go). - Manual Invalidation: Deleting cache entries directly (distributed.go).
- Versioned Cache: Associating a version with each cache entry and updating the version when the data changes (version.go).
- Write-Through Cache: Updating the cache whenever the underlying data source is updated (wtc.go).
- Event-Based Invalidation: Using Redis Pub/Sub to broadcast invalidation events to other cache instances (event.go).
- Invalidate with Callbacks: Using callbacks to trigger functions on invalidation (ioc.go).
- distributed.go: Manual cache invalidation using Redis.
- event.go: Event-based cache invalidation using Redis Pub/Sub.
- ioc.go: Shows how to invalidate cache with callbacks.
- lru.go: (Currently empty) Intended for LRU cache implementation.
- time.go: Demonstrates time-based cache expiration using
go-cache
. - version.go: Versioned cache invalidation strategy.
- wtc.go: Write-Through cache pattern.