mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-25 14:26:58 +00:00
fix cache
This commit is contained in:
parent
1438699b73
commit
de98ed5656
2 changed files with 8 additions and 1 deletions
|
@ -7,6 +7,8 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"codeberg.org/codeberg/pages/server/cache"
|
||||
)
|
||||
|
||||
|
@ -97,10 +99,15 @@ func (t *writeCacheReader) Close() error {
|
|||
|
||||
func (f FileResponse) CreateCacheReader(r io.ReadCloser, cache cache.SetGetKey, cacheKey string) io.ReadCloser {
|
||||
buf := []byte{}
|
||||
if r == nil || cache == nil || cacheKey == "" {
|
||||
log.Error().Msg("could not create CacheReader")
|
||||
return r
|
||||
}
|
||||
return &writeCacheReader{
|
||||
rc: r,
|
||||
buff: bytes.NewBuffer(buf),
|
||||
f: &f,
|
||||
cache: cache,
|
||||
cacheKey: cacheKey,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue