Send Docs Feedback

Persistence tools in Edge

This topic describes the types of persistence supported by Apigee Edge policies and the management API.

Backend response caching

You can cache the response of a backend resource with the 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.

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.

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, LookupCache policy, and InvalidateCache 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.

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.

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 for suggestions.  

Long-term persistence of key/value data

Edge offers a couple of options for long-term persistence of key/value data: key value maps and the Edge secure store (vault).

Key value maps

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 whitelisting/blacklisting.
  • 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.

Edge secure store (vault)

The Edge secure store was the original tool for creating groups (vaults) of encrypted keys/values. While you can still create vaults with the management API and retrieve entries with the apigee-access Node.js module in your API proxy code, encrypted key value maps (previous section) provide additional options for creation and retrieval of encrypted data with the management UI, management API, policies, and Node.js.

For more information on the secure store, see Using the secure store.

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.

Note that you cannot manage the Edge "shared" cache with the management API. For more information on the shared cache, see Cache internals.

 

Help or comments?