Module resty.dynacode.cache

Provide a caching mechanism for the plugins API response.

It uses the nginx shared memory as the backend storage. It is shared among all the workers.

Functions

setup (opt) Setup function.
should_refresh () Should fresh.
get () Cache get.
set (string) Cache set.


Functions

setup (opt)
Setup function.

Parameters:

  • opt options to configure the caching
    • now function - a function that returns epoch now.
    • ttl number - after the ttl the cache should be refreshed

Returns:

  1. bool - status - if it's a success or not
  2. string - when there's an error this is the error message
should_refresh ()
Should fresh. it returns whether the client should refill the cache or not.

Returns:

    bool - status - if it's a success or not
get ()
Cache get. it returns the cache value.

Returns:

    string - api response
set (string)
Cache set. it sets the cache value.

Parameters:

  • string value
generated by LDoc 1.4.6 Last updated 2022-03-10 17:13:14