mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-06-05 23:03:48 +00:00
92359c1114
* Disable startup headers. * Add banning / unbanning of specific user.
26 lines
506 B
Go
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
|
|
}
|