The "cachesample" policy only pretend to show as example how the cache works, save and retrieve values using cache assertion.
CA API Gateway 10.x , 11.x
Customer requiring example to understand how to use the cache assertion. Due during the testing is not collecting values as expected
1. the policy sent only pretend to show as example how to cache works, save and retrieve values using cache assertion.
when hitting the call#1 and/or Call#2, I'm showing the token value all time, so this is "educational" , the token value will appears as output all the time
When using the lookup assertion , has set "maximum acceptable age"=300 seconds
Also , note the following , for Cache Storage properties , the following values has been set :
Maximum entries = 10
Maximum Entry Age (seconds)= 300
Maximum entry Bytes =1000
*** All above is located at the line#12 on sample policy
So, if you are using this calls after 5 mins , you will not have the expected values returning.
2. How to use the Policy Example on a call :
Call#1 https://GwName.domain.com:8443/cachesample?token=111&var=Stored/Cached
token: 111
Value: Stored/Cached
action:
exists: Storing
Response:
The first call has a Value, to be cached (Stored/Cached)
the second call has a Response, which is the value cached on call#1...
call#2 : https://GwName.domain.com:8443/cachesample?token=111&lookup=true
token: 111
Value:
action: true
exists: true
Response: Stored/Cached
On the call#2 , the Action and Exist=true (both), and the Response=Stored/Cached, this means the value 111 is cached.
3. if you use the call#2 again but changes the value to 333 and that value was not cached before with the call#1 will show this
https://GwName.domain.com:8443/cachesample?token=333&lookup=true
token: 333
Value:
action: true
exists: Storing
Response:
there is not response value here, means the 333 has not been cached or was already deleted from cache(passed 300 seconds).
4. However if using a new call like :
https://GwName.domain.com:8443/cachesample?token=444&var=Saved444
Results will be :
token: 444
Value: Saved444
action:
exists: Storing
Response:
And then looking for the token 4444, but the value cached was using var "Saved444"
https://GwName.domain.com:8443/cachesample?token=444&lookup=true
token: 444
Value:
action: true
exists: true
Response: Saved444
Note : If do you need help to create a more sophisticated or complex policy you would to contact Broadcom Services Team or partner to help on that purpose