Why Use a Cache?
You can improve performance by caching data your proxy uses. For a simple example, see Optimize performance using cache.
You might want to use a general purpose cache to:
- Reduce latency: A request satisfied from the cache gets the representation and displays it in a shorter time. The server is more responsive with requests satisfied from the cache, which is closer to the client than the origin server.
- Reduce network traffic: Representations are reused, reducing the impact of processing duplicate or redundant requests. Using a cache also reduces the amount of bandwidth you use.
- Persist data across transactions: You can store session data for reuse across HTTP transactions.
- Support security: You may need "scope" access to the contents of a cache so it can only be accessed in a particular environment or by a specific API proxy.
For example, you might want to use the cache resource to cache OAuth access tokens used for calls from Apigee Edge to protected backend services. By caching tokens, you can avoid getting a new token for each request.
About the Underlying Data Store
Data is cached in the underlying persistence store, a Cassandra (NoSQL) database. When you're configuring general purpose caching with the Populate Cache policy, LookupCache policy, and InvalidateCache policy, you specify whether to use a cache you configure or a shared cache that's included by default. You don't need to know about the persistence store implementation to use caching.
The shared cache works well for basic use cases, but you can also create dedicated custom caches for specific applications. For more about creating a cache, see Manage environment caches.
You can create multiple caches in your organization. To support data segregation, a cache's scope is the environment in which the cache is created. For example, API proxies running in a "test" environment cannot access data in a cache running in "prod". Once you create a cache, you can use cache policies to cache any serializable data.
For guidance on which type of cache or persistence to use in different situations, see Caching and data persistence.
Help or comments?