Skip to content

Commit

Permalink
- vary JSON body fields
Browse files Browse the repository at this point in the history
- Allow force cache header
Version 2.0.1-0
  • Loading branch information
ligreman committed May 23, 2021
1 parent 0da10ce commit 0ca2e9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions kong/plugins/proxy-cache-redis/cache_key.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ end
--
-- The elements are sorted so we get consistent cache actual_keys no matter
-- the order in which params came in the request
--
-- is_json: boolean that indicates that args are a JSON object (converted into a lua table)
local function generate_key_from(args, vary_fields, is_json)
local cache_key = {}

Expand Down Expand Up @@ -95,6 +97,7 @@ local function json_body_key(json_body, plugin_config)
end
_M.json_body_key = json_body_key


local function prefix_uuid(consumer_id, route_id)

-- authenticated route
Expand All @@ -112,6 +115,7 @@ local function prefix_uuid(consumer_id, route_id)
end
_M.prefix_uuid = prefix_uuid


function _M.build_cache_key(consumer_id, route_id, method, uri, params_table, headers_table, json_body_table, conf)

-- obtain cache key components
Expand Down
4 changes: 1 addition & 3 deletions kong/plugins/proxy-cache-redis/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ local function parse_directive_header(h)

local m = iter()
while m do
local _, err = ngx_re_match(m[0], [[^\s*([^=]+)(?:=(.+))?]],
"oj", nil, res)
local _, err = ngx_re_match(m[0], [[^\s*([^=]+)(?:=(.+))?]], "oj", nil, res)
if err then
kong.log.err(err)
end
Expand Down Expand Up @@ -202,7 +201,6 @@ end

-- Guardar un valor en el Store
local function store_cache_value(premature, conf, req_body, status, proxy_cache)
--kong.log.err("%% mira que ttl me viene de conf ", conf.cache_ttl)

local res = {
status = status,
Expand Down

0 comments on commit 0ca2e9a

Please sign in to comment.