lib/conjur/has_attributes.rb in conjur-api-4.30.0 vs lib/conjur/has_attributes.rb in conjur-api-4.31.0
- old
+ new
@@ -105,12 +105,20 @@
ensure
@attributes = nil
end
protected
+
# @api private
# Fetch the attributes, overwriting any current ones.
def fetch
- @attributes = JSON.parse(get.body)
+ @attributes ||= fetch_attributes
+ end
+
+ def fetch_attributes # :nodoc:
+ cache_key = Conjur.cache_key self.username, self.url
+ Conjur.cache.fetch_attributes cache_key do
+ JSON.parse(get.body)
+ end
end
end
end
\ No newline at end of file