In Apigee hybrid and Apigee X, caches cannot be created via Apigee Google Cloud APIs. However, they can be listed and deleted via Apigee Google Cloud APIs.
If you are trying to list caches via the List Caches API in an Apigee hybrid or Apigee X environment and do not see the caches used in API proxies this article may help you to understand the reason for that.
In Cache policies, the <CacheResource> element value is used for specifying the cache name. If it is not set, Apigee will use an internal shared cache for executing the relevant cache operation. This internal shared cache name is not be listed in the "GET https://apigee.googleapis.com/v1/{parent=organizations/*/environments/*}/caches" API.
You could read more information about this functionality on the below documentation pages:
If you have encountered this issue please try to set a cache name in your PopulateCache and LookupCache policies using <CacheResource> element and deploy the relevant proxies. Once the proxies are deployed you should see those caches being listed via the "GET https://apigee.googleapis.com/v1/{parent=organizations/*/environments/*}/caches" API.
An Example
Populate Cache Policy:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PopulateCache async="false" continueOnError="false" enabled="true" name="Populate-Cache-1">
<!-- The cache to write to. -->
<CacheResource>foo-cache-global</CacheResource>
<!-- The source of the data, a variable containing the value. -->
<Source>foo-flow-var</Source>
<!-- An enumeration representing a prefix for namespace scope. -->
<Scope>Global</Scope>
<!-- A unique pointer (a flow variable value) to the data. Use this later to retrieve it. -->
<CacheKey>
<KeyFragment>foo-key</KeyFragment>
<KeyFragment ref="request.queryparam.foo"/>
</CacheKey>
<!-- Entries placed into the cache with this policy will expire after 600 seconds. -->
<ExpirySettings>
<TimeoutInSec>600</TimeoutInSec>
</ExpirySettings>
</PopulateCache>
Lookup Cache Policy:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LookupCache async="false" continueOnError="false" enabled="true" name="Lookup-Cache-1">
<!-- The cache to read from. -->
<CacheResource>foo-cache-global</CacheResource>
<!-- Where to assign the retrieved value - here, a variable. -->
<AssignTo>foo-flow-var</AssignTo>
<!-- An enumeration representing a prefix for namespace scope. -->
<Scope>Global</Scope>
<!-- The unique pointer (a flow variable value) that was used to store the data in the cache. -->
<CacheKey>
<KeyFragment>foo-key</KeyFragment>
<KeyFragment ref="request.queryparam.foo"/>
</CacheKey>
</LookupCache>
A Example List Caches API Request
curl -i -H "Authorization: Bearer $TOKEN" "https://apigee.googleapis.com/v1/organizations/${org}/environments/${env}/caches/"
HTTP/2 200
...
[
"foo-cache-global"
]
If required, you could delete a cache using the Delete Cache API, for an example:
cache_id=foo-cache-global
curl -i -X DELETE -H "Authorization: Bearer $TOKEN" "https://apigee.googleapis.com/v1/organizations/${org}/environments/${env}/caches/${cache_id}"
HTTP/2 204
…