mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
resources: Adjust the remote Get cache so it does not get evicted on restarts
We fill improve this, soon.
This commit is contained in:
parent
8aa7257f65
commit
08a863e1e8
1 changed files with 4 additions and 1 deletions
|
@ -156,7 +156,10 @@ func (c *Client) FromRemote(uri string, options map[string]interface{}) (resourc
|
||||||
|
|
||||||
resourceID := helpers.HashString(uri, options)
|
resourceID := helpers.HashString(uri, options)
|
||||||
|
|
||||||
return c.rs.ResourceCache.GetOrCreate(resources.ResourceCacheKey(resourceID), func() (resource.Resource, error) {
|
// This caches to memory and will, in server mode, not be evicted unless the resourceID changes
|
||||||
|
// or the server restarts.
|
||||||
|
// There is ongoing work to improve this.
|
||||||
|
return c.rs.ResourceCache.GetOrCreate(resourceID, func() (resource.Resource, error) {
|
||||||
method, reqBody, err := getMethodAndBody(options)
|
method, reqBody, err := getMethodAndBody(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to get method or body for resource %s", uri)
|
return nil, errors.Wrapf(err, "failed to get method or body for resource %s", uri)
|
||||||
|
|
Loading…
Reference in a new issue