You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/06/24 09:00:06 UTC
[GitHub] [incubator-apisix] powermanlc opened a new issue #1768: whas does it mean core.lrucache.plugin_ctx()?
powermanlc opened a new issue #1768:
URL: https://github.com/apache/incubator-apisix/issues/1768
### Issue description
1.in plugin access stage,why must use lurcache get conf? actually params already provided.
**example**
```
function _M.access(conf, ctx)
local lim, err = core.lrucache.plugin_ctx(plugin_name, ctx,
create_limit_obj, conf)
```
`core.log.info("conf: ", cre.json.delay_encode(conf, true)) --can print conf info
`
2.lrucache in apisix,why must band plugin? why don't like redis set key value, this simple.
**example**
```
local data = cache:get(key)
if not data then
data = core.etcd.get(key)
end
```
**remark**
My english is not good.Too much forgiveness.
### Environment
* apisix version (cmd: `apisix version`):1.3
* OS:linux
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-apisix] powermanlc commented on issue #1768: whas does it mean core.lrucache.plugin_ctx()?
Posted by GitBox <gi...@apache.org>.
powermanlc commented on issue #1768:
URL: https://github.com/apache/incubator-apisix/issues/1768#issuecomment-650089504
I still have questions about cache.
**example**
**key-auth.lua**
```
local consumer_conf = consumer.plugin(plugin_name)
if not consumer_conf then
return 401, {message = "Missing related consumer"}
end
local consumers = core.lrucache.plugin(plugin_name, "consumers_key",
consumer_conf.conf_version,
create_consume_cache, consumer_conf)
local create_consume_cache
do
local consumer_ids = {}
function create_consume_cache(consumers)
core.table.clear(consumer_ids)
for _, consumer in ipairs(consumers.nodes) do
core.log.info("consumer node: ", core.json.delay_encode(consumer))
consumer_ids[consumer.auth_conf.key] = consumer
end
return consumer_ids
end
end -- do
```
![BWD_`ADI 6G4CM9Q%Q%U1AO](https://user-images.githubusercontent.com/12597423/85843608-faaf5b00-b7d3-11ea-8cfd-378409a0ac44.png)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-apisix] membphis commented on issue #1768: whas does it mean core.lrucache.plugin_ctx()?
Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1768:
URL: https://github.com/apache/incubator-apisix/issues/1768#issuecomment-648768967
I think the `lru` of APISIX is better, and it is simpler for the user.
![image](https://user-images.githubusercontent.com/6814606/85549203-5520ae00-b652-11ea-8b04-cea6af269664.png)
take a look at this source code: https://github.com/apache/incubator-apisix/blob/master/apisix/core/lrucache.lua
this test case file can help you: https://github.com/apache/incubator-apisix/blob/master/t/core/lrucache.t
BTW, you can take a look at my video: https://www.upyun.com/opentalk/429.html
For more information, you may love: https://github.com/apache/incubator-apisix/blob/master/README_CN.md#%E8%A7%86%E9%A2%91%E5%92%8C%E6%96%87%E7%AB%A0
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-apisix] powermanlc commented on issue #1768: whas does it mean core.lrucache.plugin_ctx()?
Posted by GitBox <gi...@apache.org>.
powermanlc commented on issue #1768:
URL: https://github.com/apache/incubator-apisix/issues/1768#issuecomment-649355122
Thank you very much.I will study these materials.Best wishes to you
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org