Something went wrong. Try again.
An experimental IndieWeb site built in Go.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748package storage
import ( "time"
"github.com/jellydator/ttlcache/v3" "go.hacdias.com/indielib/indieauth")
var authCache *ttlcache.Cache[string, *indieauth.AuthenticationRequest]var nonceCache *ttlcache.Cache[string, string]
func CleanupCaches() { AuthCache().Stop()}
func AuthCache() *ttlcache.Cache[string, *indieauth.AuthenticationRequest] { if authCache != nil { return authCache }
cache := ttlcache.New( ttlcache.WithTTL[string, *indieauth.AuthenticationRequest](10 * time.Minute), )
go cache.Start()
authCache = cache
return cache}
func NonceCache() *ttlcache.Cache[string, string] { if nonceCache != nil { return nonceCache }
cache := ttlcache.New( ttlcache.WithTTL[string, string](5 * time.Minute), )
go cache.Start()
nonceCache = cache
return cache}