Send Docs Feedback

Creating and editing an environment cache

When you don't want to use the included shared cache, you can create and configure your own cache. You can use the cache you create beneath caching policies, rather than using the the shared cache.

Under ordinary circumstances, you don't need to configure your own cache. Only configure a cache when you need to customize the cache settings and optimize performance. If you have questions about your cache resource configuration, contact Apigee Support.

For guidance on which type of cache or persistence to use in different situations, see Caching and data persistence.

Defining a cache resource

You can create multiple cache resources in each environment. When you're configuring a caching policy, you specify whether the policy should use the included shared cache or a cache you created.

For data segregation, the scope of a cache is limited to the environment in which you created the cache. (For example, API proxies running in a 'test' environment cannot access data in a cache running in 'prod'.) Once you create a cache, policies can be populate it with any serializable data. For usage, see Example: General purpose caching.

See also: Response Cache policy.

Creating and editing caches

These steps describe how to create or edit a cache using the management console.

  1. In the management UI, click the APIs menu, then click Environment Configuration.
  2. In the Environment dropdown, select the environment for which you want to configure caches.
  3. Under Caches, at the right side, click the +Cache button to add a new cache.

    The button displays the New Cache dialog.

  4. In the New Cache form, enter property values for the new cache. The following table describes the settings.
    Property Name Default Value Description Notes
    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 Sets how cache entries will be expired. Entry time to live can be a specified number of seconds after creation, a specified time of day each day, or a specified date. Populate Cache policy and Response Cache policy both override these expiration settings with their own for cache entries they create.
    Timeout in seconds | Time of Day | Date Timeout: 300 (seconds)

    Time of day: 12:00:00

    Date: current date (dd-MM-yyyy)

    The configuration setting (either integer or dateTime) for the selection you made in the Expiration Type dropdown.

    Enter time of day in the format HH:mm:ss, where HH represents the hour on a 24-hour clock. For example, 14:30:00 for 2:30 in the afternoon.

    For the time of day, the default locale and time zone will vary depending on where the code is running (which isn't knowable at configuration time). For information on configuring your locale, see Creating and editing an environment cache.

    Maximum Elements in Memory 100 Maximum number of entries kept in the in-memory cache. Beyond this limit, entries are evicted using the LRU algorithm. Entries are still available in the L2 cache data store.
    Compression false Set to true to expose an option for configuring the size threshold above which cache entries will be compressed.  
    Minimum Size in KB 1024 Minimum entry size allowed before the entry is compressed. All entries larger than the configured setting size 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.  
  5. Click Save.

Help or comments?