Hi,
The second parameter (nil in your example) is an options hash. You can use the ttl
option there to set a “time to leave”.
singletons.cache:get(token_cache_key, { ttl = 5 },
load_token_into_memory, ngx.ctx.api, access_token)
Internally this method is using ngx.shared.DICT.set
, where ttl
is passed as the exptime
parameter there - so it is in seconds.