Saltar al contenido
V volfread.xyz
LIB · Go

Gache

In simple terms

Very simple cache for Go programs: keeps data in memory or a file and forgets it automatically when it expires. Zero dependencies and easy to use.

Technical details

Generic New[T](&Options{Path, Lifetime}) library: in-memory when Path is empty or JSON/gob-persisted with atomic tmp+Rename writes. Configurable TTL, out-of-lock expiration hook and 0755/0644 permissions. Updated to Go 1.26 with hardening against corrupt files.

Go 1.26Generics

Highlights

  • Generic New[T] with Options{Lifetime, Path, ExpirationHook, Encoder}
  • Atomic writes and handling of expired/corrupt entries
  • JSON by default and gob via WithGob or custom codec

Install

go get github.com/yukiteruamano/gache

Lines of code

1,278

Go
100%

Last recorded activity

Last recorded activity 7 commits · 52 sem
Semana 1: 0 commits Semana 2: 0 commits Semana 3: 0 commits Semana 4: 0 commits Semana 5: 0 commits Semana 6: 0 commits Semana 7: 0 commits Semana 8: 0 commits Semana 9: 0 commits Semana 10: 0 commits Semana 11: 0 commits Semana 12: 0 commits Semana 13: 0 commits Semana 14: 0 commits Semana 15: 0 commits Semana 16: 0 commits Semana 17: 0 commits Semana 18: 0 commits Semana 19: 0 commits Semana 20: 0 commits Semana 21: 0 commits Semana 22: 0 commits Semana 23: 0 commits Semana 24: 0 commits Semana 25: 0 commits Semana 26: 0 commits Semana 27: 0 commits Semana 28: 0 commits Semana 29: 0 commits Semana 30: 0 commits Semana 31: 0 commits Semana 32: 0 commits Semana 33: 0 commits Semana 34: 0 commits Semana 35: 0 commits Semana 36: 0 commits Semana 37: 0 commits Semana 38: 0 commits Semana 39: 0 commits Semana 40: 0 commits Semana 41: 0 commits Semana 42: 0 commits Semana 43: 0 commits Semana 44: 0 commits Semana 45: 0 commits Semana 46: 0 commits Semana 47: 0 commits Semana 48: 0 commits Semana 49: 0 commits Semana 50: 7 commits Semana 51: 0 commits Semana 52: 0 commits

Last recorded activity in the project.