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:
[email protected]


Reply via email to