My service callout response for token success will look something like this.
{
token : "djjffedafdfrsfsffdsfffffffffffffffffasdaaaaaaa"
expirytime :" 202106:13T05:12:34:455"
}
My question is token expire on particular date and on particular time when i perform a cache lookup for token i have to check both date and time in combination.
So far i have exacted expirytime variable in JS and assigned them as reference in expire time setting in cache policy.
Looking for some direction from experts @Anil Sagar @ Google @Dino-at-Google
1. If using Apigee Edge, you can create an environment scoped cache
https://docs.apigee.com/api-platform/cache/manage-caches-environment
You will then use combination of Populate and Lookup Cache policies in your API Proxy (Or just the policies if this is for Apigee X)
2. Assuming you're wanting to check the date and time to see it hasn't expired?
Why not instead configure the cache policy to expire the entry just before the token expires when you store it in cache, this way you dont need to check the date/time
Can you elaborate more on this Why not instead configure the cache policy to expire the entry just before the token expires when you store it in cache, this way you dont need to check the date/time?
I am new to this so please bear with me.
here are my lookup and populate policies and environment cache
In PopulateCache policy, you can use ExpirySettings to directly set TimeoutInSeconds for example
There are other ways to implement it here https://docs.apigee.com/api-platform/reference/policies/populate-cache-policy#ExpirySettingsElement
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |