Question about N/cache: Is it possible to set the...
# suitescript
d
Question about N/cache: Is it possible to set the
ttl
property of a cache using the loader() function? It appears I can only set the
data
. That sucks because the endpoint I'm retrieving an access token from provides me with the
expires_in
(in seconds). So, I'm forced to implement the cache.put function (in combination with the get, etc) rather than the recommended why of the get/loader implementation.
c
When you use the get method that specifies the loader it has the ttl. That should be what you set. When it expires, the lookup value would be null so it should then use the loader... rinse and repeat. The other issue is you aren't promised that the value remains in the cache for the ttl either. It could dump prior to your ttl.
d
I don't mind an early drop ... I definately don't want it to live longer than the access code expiry.
I also don't think I explained myself very clearly in the question ... I simply wish the loader would allow you to return the ttl (not just the data)