Add a cache to workers KV storage implementation (#1284)
* cloudflare-cache * go mod tidy
This commit is contained in:
@@ -51,3 +51,13 @@ func Namespace(ns string) store.Option {
|
||||
o.Namespace = ns
|
||||
}
|
||||
}
|
||||
|
||||
// CacheTTL sets the timeout in nanoseconds of the read/write cache
|
||||
func CacheTTL(ttl int64) store.Option {
|
||||
return func(o *store.Options) {
|
||||
if o.Context == nil {
|
||||
o.Context = context.Background()
|
||||
}
|
||||
o.Context = context.WithValue(o.Context, "STORE_CACHE_TTL", ttl)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user