Skip to content

Showcasing Different Cache Invalidation Strategies (Time, Write-Through, Least Recently Used, Event, Version, Invalidate-On-Change, Distributed Caching)

Notifications You must be signed in to change notification settings

WillKirkmanM/cache-invalidation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cache Invalidation

Showcasing Different Cache Invalidation Strategies (Time, Write-Through, Least Recently Used, Event, Version, Invalidate-On-Change, Distributed Caching)

Strategies

  • 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).

Files

  • 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.

Dependencies

About

Showcasing Different Cache Invalidation Strategies (Time, Write-Through, Least Recently Used, Event, Version, Invalidate-On-Change, Distributed Caching)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages