Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps(*) bump lua-resty-mlcache to 2.6.0 #9287

Merged
merged 4 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@
[#8845](https://github.com/Kong/kong/pull/8845)
- Bumped penlight from 1.12.0 to 1.13.1
[#9206](https://github.com/Kong/kong/pull/9206)
- Bumped lua-resty-mlcache from 2.5.0 to 2.6.0
[#9287](https://github.com/Kong/kong/pull/9287)

### Additions

Expand Down
2 changes: 1 addition & 1 deletion kong-3.0.0-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies = {
"lua-protobuf == 0.3.3",
"lua-resty-worker-events == 1.0.0",
"lua-resty-healthcheck == 1.6.1",
"lua-resty-mlcache == 2.5.0",
"lua-resty-mlcache == 2.6.0",
"lua-messagepack == 0.5.2",
"lua-resty-openssl == 0.8.10",
"lua-resty-counter == 0.2.1",
Expand Down
20 changes: 14 additions & 6 deletions kong/cache/marshall.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
-------------------------------------------------------------------------------
-- NOTE: the following is copied from lua-resty-mlcache: --
------------------------------------------------------------------------ cut --
local cjson = require "cjson.safe"
local codec
do
local pok
pok, codec = pcall(require, "string.buffer")
if not pok then
codec = require "cjson"
end
end


local type = type
local pcall = pcall
local error = error
local tostring = tostring
local fmt = string.format
local now = ngx.now
local cjson_encode = cjson.encode
local encode = codec.encode


local TYPES_LOOKUP = {
Expand Down Expand Up @@ -42,12 +50,12 @@ local marshallers = {
end,

[4] = function(t) -- table
local json, err = cjson_encode(t)
if not json then
return nil, "could not encode table value: " .. err
local pok, str = pcall(encode, t)
if not pok then
return nil, "could not encode table value: " .. str
end

return json
return str
end,
}

Expand Down