disable cache at build time.

using build tag `nocache` to disable usage of the disk cache entirely.
This commit is contained in:
fiatjaf
2023-07-12 14:21:55 -03:00
parent 9dbd4d6d40
commit c0cbb3c27c
5 changed files with 31 additions and 12 deletions

19
null_cache.go Normal file
View File

@@ -0,0 +1,19 @@
//go:build nocache
package main
import (
"time"
)
var cache = Cache{}
type Cache struct{}
func (c *Cache) initialize() func() { return func() {} }
func (c *Cache) Get(key string) ([]byte, bool) { return nil, false }
func (c *Cache) GetJSON(key string, recv any) bool { return false }
func (c *Cache) Set(key string, value []byte) {}
func (c *Cache) SetJSON(key string, value any) {}
func (c *Cache) SetWithTTL(key string, value []byte, ttl time.Duration) {}
func (c *Cache) SetJSONWithTTL(key string, value any, ttl time.Duration) {}