Was this helpful?

 

API Platform Base Path: https://api.enterprise.apigee.com/v1/o/{org_name}

API Resource Path:

/environments/{env_name}/caches

Description: Creates a cache in an environment

Verb: POST
Auth: Basic Auth
Media types:
application/json
text/xml

 

Overview: Use the Edge management API to create a cache resource. Caches are created per environment. For data segregation, a cache created in 'test', for example, cannot be accessed by API proxies deployed in 'prod'.

The JSON object in the request body can be empty, or the <Cache/> tag in XML can be empty, to create a cache with the default settings.

Sample Request:
$ curl -H "Content-Type:application/json" -X POST -d \
'{
  "compression": {
    "minimumSizeInKB": 50
  },
  "description": "Foo cache",
  "diskSizeInMB": 0,
  "expirySettings": {
    "expiryDate": {
      "value": "05-20-2014"
    },
    "valuesNull": false
  },
  "inMemorySizeInKB": 0,
  "maxElementsInMemory": 100,
  "maxElementsOnDisk": 1000,
  "overflowToDisk": true,
  "persistent": false,
  "skipCacheIfElementSizeInKBExceeds": 1000
}' \
https://api.enterprise.apigee.com/v1/o/{org_name}/environments/test/caches?name=myCache \
-u myname:mypass

Query Parameters:

Name

Description

Default

Required?

name

Specify the cache name. The characters you are allowed to use in a name are restricted to the following: A-Z0-9._\-$ %. For example, Cat2 %_ is a legal name.

N/A

Yes

Request payload elements:

Name

Description

Default

Required?

description

A description of the cache resource.

N/A

No

diskSizeInMB Specifies the disk space used for the cache, in megabytes. 0 No

expirySettings

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.

Options include:

  • timeoutInSec
  • timeOfDay (hh:mm:ss)
  • expiryDate (mm-dd-yyyy)

300 seconds

No

maxElementsInMemory

Maximum number of entries the cache keeps in memory. Upon reaching the max limit the entries are evicted using the LRU algorithm.

100

No

maxElementsOnDisk Maximum number of entries kept on disk. Upon reaching the max limit the entries are evicted using the LRU algorithm. 1000 No

inMemorySizeInKB

All entries larger than the configured setting size, in kilobytes, will be compressed before being cached.

0

No

compression

If specified, enables you to configure the size threshold above which cache entries will be compressed. If not specified, compression is disabled.

Options include:

  • minimumSizeInKB: All entries larger than the configured setting size, in kilobytes, will be compressed before being cached.

false

No

overflowToDisk Specifies to overflow the in-memory cache to disk. false No
persistent Enables cache entries to be persistent across restarts. false No

skipCacheIfElementSizeInKBExceeds

If specified, enables you to configure the maximum size of data to be cached. Specify the size limit, in kilobytes, for cache entries. Data larger than the limit you set will not be cached.

disabled

No

 

Sample Response:
{
  "compression" : {
    "minimumSizeInKB" : 50
  },
  "description" : "Foo cache",
  "diskSizeInMB" : 0,
  "expirySettings" : {
    "expiryDate" : {
      "value" : "05-20-2014"
    },
    "valuesNull" : false
  },
  "inMemorySizeInKB" : 0,
  "maxElementsInMemory" : 100,
  "maxElementsOnDisk" : 1000,
  "name" : "myCache",
  "overflowToDisk" : true,
  "persistent" : false,
  "skipCacheIfElementSizeInKBExceeds" : 1000
}

 

Help or comments?

  • Something's not working: See Apigee Support
  • Something's wrong with the docs: Click Send Feedback in the lower right.
    (Incorrect? Unclear? Broken link? Typo?)