mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-28 16:55:32 +00:00
28 lines
398 B
Go
28 lines
398 B
Go
package server
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
"github.com/gofiber/storage/memory/v2"
|
|
)
|
|
|
|
type Cache struct {
|
|
*memory.Storage
|
|
}
|
|
|
|
const (
|
|
CACHE_GC_INTERVAL = 24 * time.Hour
|
|
)
|
|
|
|
func NewCache() Cache {
|
|
return Cache{memory.New(memory.Config{
|
|
GCInterval: CACHE_GC_INTERVAL,
|
|
}),
|
|
}
|
|
}
|
|
|
|
func KeyGenerator(c *fiber.Ctx) string {
|
|
return c.Path() + c.Context().QueryArgs().String()
|
|
}
|