mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-05-14 17:27:10 +02:00
Move redis config to CacheConfig struct, add cache prefixes & trace logging
This commit is contained in:
parent
e1a22d5f4c
commit
46c8daacba
7 changed files with 45 additions and 30 deletions
|
@ -78,24 +78,24 @@ func Serve(ctx *cli.Context) error {
|
|||
dnsLookupCache := mcache.New()
|
||||
|
||||
var redisErr error = nil
|
||||
createCache := func() cache.ICache {
|
||||
if cfg.RedisURL != "" {
|
||||
opts, err := redis.ParseURL(cfg.RedisURL)
|
||||
createCache := func(name string) cache.ICache {
|
||||
if cfg.Cache.RedisURL != "" {
|
||||
opts, err := redis.ParseURL(cfg.Cache.RedisURL)
|
||||
if err != nil {
|
||||
redisErr = err
|
||||
}
|
||||
return cache.NewRedisCache(opts)
|
||||
return cache.NewRedisCache(name, opts)
|
||||
}
|
||||
return cache.NewInMemoryCache()
|
||||
}
|
||||
// challengeCache stores the certificate challenges
|
||||
challengeCache := createCache()
|
||||
challengeCache := createCache("challenge")
|
||||
// canonicalDomainCache stores canonical domains
|
||||
canonicalDomainCache := createCache()
|
||||
canonicalDomainCache := createCache("canonicalDomain")
|
||||
// redirectsCache stores redirects in _redirects files
|
||||
redirectsCache := createCache()
|
||||
redirectsCache := createCache("redirects")
|
||||
// clientResponseCache stores responses from the Gitea server
|
||||
clientResponseCache := createCache()
|
||||
clientResponseCache := createCache("clientResponse")
|
||||
if redisErr != nil {
|
||||
return redisErr
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue