Cache Keys - Any disallowed characters? My Cache Policy is resulting in a miss which should be a hit

Not applicable

Are certain characters disallowed as cache keys? I'm getting cache misses when I expect to have hits. Below are two requests fired one after the other, and the policy that is resulting in a cache MISS. Any ideas?

REQUEST #1
----------
request.uri /my-api/my-resource/aa:bb:a989rr23-qq11-lkjj3-1123kj-191iei010e94
responsecache.cachename orgName__envName
responsecache.executed 1
responsecache.cachekey orgName__envName__My-API__default__/my-api/my-resource/aa:bb:a989rr23-qq11-lkjj3-1123kj-191iei010e94
cachehit 0
responsecache.cachesource CACHE_MISS


REQUEST #2
----------
request.uri /my-api/my-resource/aa:bb:a989rr23-qq11-lkjj3-1123kj-191iei010e94
responsecache.cachename orgName__envName
responsecache.executed 1
responsecache.cachekey orgName__envName__My-API__default__/my-api/my-resource/aa:bb:a989rr23-qq11-lkjj3-1123kj-191iei010e94
cachehit 0
responsecache.cachesource CACHE_MISS


CACHING POLICY
--------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ResponseCache async="false" continueOnError="false" enabled="true" name="Response-Cache-2">
 <DisplayName>Response Cache-2</DisplayName>
 <Properties/>
 <CacheKey>
 <Prefix/>
 <KeyFragment ref="request.uri" type="string"/>
 </CacheKey>
 <Scope>Exclusive</Scope>
 <ExpirySettings>
 <ExpiryDate/>
 <TimeOfDay/>
 <TimeoutInSec ref="">600</TimeoutInSec>
 </ExpirySettings>
 <SkipCacheLookaa/>
 <SkipCachePopulation/>
</ResponseCache>
Solved Solved
1 2 438
1 ACCEPTED SOLUTION

Hi @kford

Welcome to the community !!!!

The ResponseCache policy type is unique in that it must be attached to both the request and response flow in an API proxy (PreFlow, Flow, or PostFlow)

Can you confirm if you added the Response Cache policy to both Request and Response flow ? I tried a sample and it worked for me

5033-screen-shot-2017-06-06-at-115724-pm.png

Let me know if that did the trick..

View solution in original post

2 REPLIES 2

Hi @kford

Welcome to the community !!!!

The ResponseCache policy type is unique in that it must be attached to both the request and response flow in an API proxy (PreFlow, Flow, or PostFlow)

Can you confirm if you added the Response Cache policy to both Request and Response flow ? I tried a sample and it worked for me

5033-screen-shot-2017-06-06-at-115724-pm.png

Let me know if that did the trick..

You are correct. Apigee must have added it to the response flow for me automatically, as I tried this test several times and it worked universally. We must have inadvertently removed the response side of the policy so the cache was never being populated. Thanks for your help!