Manage environment caches
API Services exposes a cache resource that can be used at runtime to persist data across transactions.
There are three main reasons for using a cache:
- To reduce latency: The request is satisfied from the cache (which is closer to the client) instead of the origin server, so the cache gets the representation and displays it in a shorter time. This makes the server more responsive.
- To reduce network traffic: Representations are reused, so the impact of processing duplicate or redundant requests is reduced. Cache reduces the amount of bandwidth you use, which decreases bandwidth requirements overall.
- To persist data across transactions: Session data can be stored for reuse across HTTP transactions.
You can create multiple cache resources in each environment. For data segregation, the scope of a cache is limited to an 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 the cache is created, it can be populated with any serializable data by using cache policies. For usage, see Optimize performance using cache.
When you're configuring policies to use general purpose caching, you specify whether to use a cache you configure or a shared cache that's included by default. Under ordinary circumstances, you do not need to explicitly configure a cache. Only configure your own cache when you need to customize the cache settings and optimize performance. If you have questions about your cache resource configuration, contact Apigee Support.
See also: Response Cache policy.
Navigate to environment configuration
From the main menu, select Environment Configuration from the APIs drop-down:
A drop-down menu displays a list of all available environments in your organization. Select the environment whose caches you need to view or edit.
Select the Add a Cache button:
Enter configuration settings for cache
A form displays that enables you to configure a cache. The form is shown below. Configuration settings are described in the table below the image.
Modifying a cache configuration
A cache configuration has the following properties:
|Property Name||Default Value||Description|
|Name||mycache||The name of the cache. Must be unique in the environment. Reference this cache from policies that interact with the cache resource.|
|Description||N/A||An optional description of the cache resource.|
|Expiration Type||Timeout in Seconds||Enables different expiration mechanisms to be applied to entries in the cache. Cache entries can be expired a certain number of seconds after creation, at a specific time of day each day, or on a specific date.|
|Timeout in seconds | Time of Day | Date||300||The configuration setting (either integer or dateTime) for the previous selection, "Expiration Type".|
|Maximum Elements in Memory||100||Maximum number of entries, cache keeps in memory. Upon reaching the max limit the entries are evicted using the LRU algorithm.|
|Compression||false||An option that can be enabled or disabled. When enabled, an option is exposed that enables you to configure the size threshold above which cache entries will be compressed.|
|Minimum Size in KB||1024||All entries larger than the configured setting size, in kilobytes, will be compressed before being cached.|
|Skip if Element Size in KB Exceeds||512 kilobytes||The size limit, in kilobytes, for cache entries. Data larger than the limit you set will not be cached.|
Help or comments?