API / APIGEE Gateway Interview Questions
What is response caching in Apigee and how do you configure the ResponseCache policy?
The ResponseCache policy stores successful backend responses in Apigee's in-memory cache. When an identical subsequent request arrives within the cache TTL, Apigee serves the cached response directly without contacting the backend at all. This reduces backend load and improves latency.
<!-- ResponseCache policy --> <ResponseCache name="ResponseCache"> <!-- How to build the cache key --> <CacheKey> <Prefix>weather</Prefix> <!-- Cache key includes the city query parameter --> <KeyFragment ref="request.queryparam.city" /> </CacheKey> <!-- How long to cache the response --> <ExpirySettings> <TimeoutInSec>300</TimeoutInSec> <!-- 5 minutes --> </ExpirySettings> <!-- Skip caching if the client sends Cache-Control: no-cache --> <SkipCacheLookup>request.header.cache-control = "no-cache"</SkipCacheLookup> </ResponseCache> <!-- Placement: ResponseCache appears in BOTH: 1. ProxyEndpoint PreFlow Request (to check for cache hit) 2. ProxyEndpoint PostFlow Response (to populate the cache on cache miss) Apigee handles the dual role automatically with this single policy --> <!-- Flow variables after policy executes: responsecache.ResponseCache.cachehit -- true/false responsecache.ResponseCache.cachekey -- the computed cache key -->
| Policy | Scope | Purpose |
|---|---|---|
| ResponseCache | Full response body | Cache entire response to avoid backend calls |
| LookupCache | Arbitrary values | Read arbitrary data from cache (used with PopulateCache) |
| PopulateCache | Arbitrary values | Write arbitrary data into a named cache |
| InvalidateCache | Arbitrary values | Explicitly remove entries from cache |
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
