summaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-11-30 16:54:01 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-11-30 16:54:01 +0100
commit08a863e1e8c7761253939bbafdfdfb9d67df266c (patch)
treef46884edf74580c802432cbd2e6aa2af95119b64 /resources
parent8aa7257f652ebea70dfbb819c301800f5c25b567 (diff)
resources: Adjust the remote Get cache so it does not get evicted on restarts
We fill improve this, soon.
Diffstat (limited to 'resources')
-rw-r--r--resources/resource_factories/create/create.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/resources/resource_factories/create/create.go b/resources/resource_factories/create/create.go
index 4832b3cbe..4ad3da448 100644
--- a/resources/resource_factories/create/create.go
+++ b/resources/resource_factories/create/create.go
@@ -156,7 +156,10 @@ func (c *Client) FromRemote(uri string, options map[string]interface{}) (resourc
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)
if err != nil {
return nil, errors.Wrapf(err, "failed to get method or body for resource %s", uri)