Skip to content

自定义插件在check_schema阶段处理完数据后,在access阶段使用会不会有什么问题? #7463

Answered by soulbird
Horus-K asked this question in Q&A
Discussion options

You must be logged in to vote

It is a good choice to use lrucache to cache the value of ngx. decode_base64 in the early access phase. No need to pass value.

local lrucache = core.lrucache.new({
    type = "plugin"
})
function _M.access(conf, ctx)
    core.response.set_header("Content-Type", "text/html")
    local body = lrucache(plugin_name, conf, ngx.decode_base64, conf.body)
    return 200, body
end

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Horus-K
Comment options

You must be logged in to vote
1 reply
@tzssangglass
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants