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:
- bool - status - if it's a success or not
- string - when there's an error this is the error message
- opt options to configure the caching
- 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