Files
graphql-monitoring-proxy/cache.go
T
lukaszraczylo 92359c1114 Cleanup pt 1 (#4)
* Disable startup headers.

* Add banning / unbanning of specific user.
2023-10-19 14:36:16 +01:00

26 lines
506 B
Go

package main
import (
"time"
fiber "github.com/gofiber/fiber/v2"
"github.com/gookit/goutil/strutil"
libpack_cache "github.com/lukaszraczylo/graphql-monitoring-proxy/cache"
)
func calculateHash(c *fiber.Ctx) string {
return strutil.Md5(c.Body())
}
func enableCache() {
cfg.Cache.CacheClient = libpack_cache.New(time.Duration(cfg.Cache.CacheTTL) * time.Second * 100)
}
func cacheLookup(hash string) []byte {
obj, found := cfg.Cache.CacheClient.Get(hash)
if found {
return obj
}
return nil
}