Fix leaky bytes allocation for cache.

This commit is contained in:
2023-10-13 16:29:52 +01:00
parent 089d05b7c3
commit 6ac3937066
3 changed files with 16 additions and 20 deletions
+4 -6
View File
@@ -14,15 +14,13 @@ func calculateHash(c *fiber.Ctx) string {
}
func enableCache() {
cfg.Cache.CacheClient = libpack_cache.New(time.Duration(cfg.Cache.CacheTTL) * time.Second * 2)
cfg.Cache.CacheClient = libpack_cache.New(time.Duration(cfg.Cache.CacheTTL) * time.Second * 100)
}
func cacheLookup(hash string) []byte {
if cfg.Cache.CacheClient != nil {
obj, found := cfg.Cache.CacheClient.Get(hash)
if found {
return obj
}
obj, found := cfg.Cache.CacheClient.Get(hash)
if found {
return obj
}
return nil
}