You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs/api-platform/cache/persistence-tools). info

**What's here**

Apigee Edge mechanisms for caching and persistence include **short-term** and
**long-term** persistence. There are policies for **response** caching
and **general purpose** caching. Use the management API to **manage
caches**.

## Backend response caching

You can cache the response of a backend resource with the
[Response Cache policy](https://docs.apigee.com/api-platform/reference/policies/response-cache-policy).

This is especially helpful when backend data is updated only periodically. The ResponseCache
policy can reduce calls to backend data sources.

Through the ResponseCache policy, you can also have Edge look at certain HTTP response caching
headers and take actions according to header directives. For example, on responses from backend
targets, Edge supports the `Cache-Control` header. This header can be used to control
the maximum age of a cached response, among other things. For more information, see
[Support for HTTP response headers](https://docs.apigee.com/api-platform/cache/http-response-caching).

> [!NOTE]
> **Note:** The policy uses either a cache you configure or a shared cache that's included by default. To use the underlying shared cache, simply omit the `<CacheResource>` element when configuring the policy. For more about configuring caches, see [Creating and
> editing an environment cache](https://docs.apigee.com/api-platform/cache/manage-caches-environment).

## Short-term general purpose caching

Using policies for general purpose caching, you can persist any objects your proxy requires
across multiple request/response sessions.

With the [Populate Cache
policy](https://docs.apigee.com/api-platform/reference/policies/populate-cache-policy), [LookupCache
policy](https://docs.apigee.com/api-platform/reference/policies/lookup-cache-policy), and [InvalidateCache policy](https://docs.apigee.com/api-platform/reference/policies/invalidate-cache-policy),
you can populate, retrieve, and flush cached data at runtime.

For example, you might temporarily store:

- Session IDs for session management.
- Credentials for outbound calls (such as API keys or OAuth access tokens).
- Response content that must be paginated for apps.

At runtime, your cache policies copy values between proxy variables and the configured cache
you specify. When a value is placed in the cache, it is copied from the variable you specify to
the cache. When it is retrieved from the cache, it is copied into the variable for use by your
proxy.

For an example with code, see
[Example: General purpose caching](https://docs.apigee.com/api-platform/cache/optimize-performance-using-cache).

> [!NOTE]
> **Note:** These policies use either a cache you configure or a shared cache that's included by default. To use the underlying shared cache, simply omit the `<CacheResource>` element when configuring the policy. For more about configuring caches, see [Creating and
> editing an environment cache](https://docs.apigee.com/api-platform/cache/manage-caches-environment).

> [!IMPORTANT]
> **Tip:** If you're wondering about how to cache an SSL certificate needed to make HTTP calls from a Node.js app running on Edge, see this [Apigee Community
> post](https://discuss.google.dev/t/caching-files-in-node-js/11502) for suggestions.

## Long-term persistence with key value maps (KVMs)

To indefinitely store structured data either encrypted or unencrypted, you can create and
populate key value maps (KVMs) that contain arbitrary key/value pairs. For example, you might
store:

- A map correlating IP addresses to country codes.
- A list of IP addresses for allowlisting/denylisting.
- A map correlating long URLs to shortened URLs.
- Environment-specific data, such as quota counts and OAuth token expiration times.

KVMs can have one of three scopes: organization, environment, apiproxy. For example, if
key/value pairs are to be used for all APIs in an organization, create a KVM at the organization
scope; or if only a specific API proxy should have access to keys/values, create the KVM at the
apiproxy scope. You can create, manage, and retrieve key value maps in a number of ways. For more
information, see [Working with key value maps](https://docs.apigee.com/api-platform/cache/key-value-maps).

## Managing cache with the management API

If you want to create, view, update, delete, and clear cache outside the scope of policies in
a message flow, you can use the [Caches management API](https://docs.apigee.com/api/caches).

> [!NOTE]
> **Note:** Note that you cannot manage the Edge "shared" cache with the management API. For more information on the shared cache, see [Cache internals](https://docs.apigee.com/api-platform/cache/cache-internals).