Is each individual Gateway node has a different cache or a common cache?
We believe there should be only one common cache. But we have encountered an issue something as explained below. This could be possible only if the individual node has their own cache.
---------------------------------------------------
We have two node gateway cluster. We have a policy with 3rd party system as backend service who authenticates using Auth 2.0 Tokens.
1. Check if the valid token is available in Cache ('Look Up In Cache').
2. If valid Token is not available from
3. Get 3rd Party API Access Token valid for 3559 Secs.
4. Store token in Cache using assertion 'Store To Cache' with expiry to 3000 Secs.
5. Call 3rd Party API with valid/updated Token.
> 3rd Party system can have only one valid token for each API-key at given time.
Issue:
Request 1 on Gateway Node 1:
1. Look Up token from Node 1 Cache: Not available
2. Get Access token and stored to cache with expiry to 3000 Secs.Assum Token Values in 'token-one'.
3. Call 3rd Party API with a valid token.
Request 2 on Gateway Node 2:
1. Look Up token from Node 2 Cache: Not available
2. Get Access token and stored to cache with expiry to 3000 Secs.Assum Token Values in 'token-two'.
Note: Token 'token-one' generated
3. Call 3rd Party API with a valid token.
Request 3 on Gateway Node 1:
1. Look Up token from Node 1 Cache: ('token-one' is available from Node 1 cache which has already expired in 3rd Party system).
2.Call 3rd Party API with Invalid token 'token-one'. The 3rd party returns invalid token error.
Can someone please confirm if each node will have their cache? If yes then it's an issue as explained above. How to solve this to have a common place to store a token which should be accessible across all gateway nodes.
Regards
Kareem