fix cache key (#3886)
This commit is contained in:
@@ -2,7 +2,8 @@ module HttpartyCache
|
|||||||
extend self
|
extend self
|
||||||
|
|
||||||
def get(url, headers: {}, params: {}, base_uri: nil, format: :html, expiry: 60)
|
def get(url, headers: {}, params: {}, base_uri: nil, format: :html, expiry: 60)
|
||||||
Cache.get("cachedget:#{Cache.hash(url)}", expiry) do
|
key = Cache.hash({url: url, headers: headers, params: params, base_uri: base_uri, format: format}.to_s)
|
||||||
|
Cache.get("cachedget:#{key}", expiry) do
|
||||||
resp = HTTParty.get(url, Danbooru.config.httparty_options.deep_merge(query: params, headers: headers, base_uri: base_uri, format: format))
|
resp = HTTParty.get(url, Danbooru.config.httparty_options.deep_merge(query: params, headers: headers, base_uri: base_uri, format: format))
|
||||||
body = resp.body.force_encoding("utf-8")
|
body = resp.body.force_encoding("utf-8")
|
||||||
[body, resp.code]
|
[body, resp.code]
|
||||||
|
|||||||
Reference in New Issue
Block a user