How do we Cache only success(200) response from micro services via API Gateway? #1890
Unanswered
chitharansivasamy
asked this question in
Q&A
Replies: 3 comments 1 reply
-
Since the response is being cached with cachemanager id guess (and it is a guess) that youd need to check the response inside here and if its not successful then not add that response to the cache:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
how did you fix it |
Beta Was this translation helpful? Give feedback.
1 reply
-
@chitharansivasamy |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Expected Behavior / New Feature
Ocelot API Gateway is supposed to caching only when gets success responses (200) from micro-services
Actual Behavior / Motivation for New Feature
The problem is we had used the below Ocelot JSON to cache the response and it's holding the data for one full day (86400 secs). here is suppose to get some errors during the services call like(500,502,499...). what happened is the cached error response was not even updated till one full day even the services issue got resolved.
"UpstreamPathTemplate": "/Products/GetProductMetaData",
"UpstreamhttpsMethod": [ "GET" ],
"FileCacheOptions": { "TtlSeconds": 86400 },
So we are looking for the gateway to cache only success and not the failure cases. It should be hit services till when its bring success(200).
Is there any option in OCELOT to restrict caching based on the HTTP Status code like 500, 502, 503, 499..etc?
Beta Was this translation helpful? Give feedback.
All reactions