Improve the server assets cache invalidation logic

Fixes #6199
This commit is contained in:
Bjørn Erik Pedersen
2019-08-13 12:35:04 +02:00
parent 6315098104
commit cd575023af
8 changed files with 206 additions and 50 deletions

View File

@@ -18,6 +18,7 @@ import (
"bytes"
"fmt"
"io"
"path"
"path/filepath"
"github.com/gohugoio/hugo/common/hugio"
@@ -66,7 +67,7 @@ func (r *multiReadSeekCloser) Close() error {
// Concat concatenates the list of Resource objects.
func (c *Client) Concat(targetPath string, r resource.Resources) (resource.Resource, error) {
// The CACHE_OTHER will make sure this will be re-created and published on rebuilds.
return c.rs.ResourceCache.GetOrCreate(resources.CACHE_OTHER, targetPath, func() (resource.Resource, error) {
return c.rs.ResourceCache.GetOrCreate(path.Join(resources.CACHE_OTHER, targetPath), func() (resource.Resource, error) {
var resolvedm media.Type
// The given set of resources must be of the same Media Type.