What is Cacher?

Cacher is a generic service that can be used to snapshot json responses, force sync them, sync them periodically, or update them by consuming dmaap events.

The json cache is managed in memory in an embedded mongodb instance.


The cacheKey endpoints manage the definition of the cache.

  • what uri to retrieve the information
  • how to manage updates
  • when were the updates started/finished
  • were the updates successful

The cache endpoints are for retrieving the actual cached json responses. See below for the API Spec.

URI

HTTP Method

Function

 Additional Information

[[domain]]:8444/aai/cacheKey/v[[version number]]/get

GETThis endpoint retrieves all cache key entries if no key is passed, or a single cache key entry if the cacheKey parameter is passed.

Accepts a query parameter of cacheKey

If provided and the cache key exists, the entry details for the cache key are returned.

if provided and the cache key does not exist, then this is communicated to the client.

If not provided, all cache keys are returned.

[[domain]]:8444/aai/cacheKey/v[[version number]]/update

PUTThis endpoint updates a given cache key with the relative updates.

Accepts a JSON payload to update a cache key entry. It can be a partial json and only the provided values will be updated.

If the key does not exist, this is communicated to the client.

[[domain]]:8444/aai/cacheKey/v[[version number]]/add

PUTThis endpoint adds a given cache key with its payload.

Accepts a JSON payload to add a cache key entry. Example payload is shown below:


{
    "_id""pserver",
    "baseUrl""https://someuri:someport",
    "module""/aai/v13/",
    "URI""cloud-infrastructure/pservers",
    "timingIndicator""onInit",
    "syncInterval""-1",
    "lastSyncStartTime""2018-05-1110:16:08.862-0400",
    "lastSyncSuccessTime""2018-05-1110:16:09.744-0400",
    "lastSyncEndTime""2018-05-1110:16:09.744-0400",
    "httpBody""-1",
    "httpMethod""GET",
    "parserStrategy""aai-resource-get-all"
}

baseUrl is required

module is optional

URI is required

timingIndicator is optional (if not provided it is defaulted to firstHit)

syncInterval is optional (if timingIndicator is provided as scheduled this is defaulted to 1440, which is a day in minutes)

 lastSyncStartTime is optional (usually just set from processing)

 lastSyncSuccessTime is optional (usually just set from processing)

 lastSyncEndTime is optional (usually just set from processing)

httpBody is mandatory is the httpMethod requires a body

httpMethod is optional (defaulted to GET is not passed in)

parserStrategy is optional (default value = "none")


[[domain]]:8444/aai/cacheKey/v[[version number]]/delete DELETEThis end point deletes a cache key entry and its associated cache.

If the cache key and associated cache are populated, both are deleted

If the cache key exists but no associated cache, the cache key is deleted

If the cache key doesn't exist, this is communicated to the client

[[domain]]:8444/aai/cache/v[[version number]]/get GETThis end point retrieves the associated cache for a cache key passed in.If the associated cache is not present, it will kick off the API call and wait for it to finish, then return the relevant response. If the associated cache is not present and a sync of the associated cache is already in process, a response regarding this will be returned.
[[domain]]:8444/aai/cache/v[[version number]]/delete DELETEThis endpoint deletes the associated cache to a provided cache key.

If populated, it is deleted.

If not populated, this is communicated to the client.

[[domain]]:8444/aai/cache/v[[version number]]/sync PUT This endpoint force syncs the associated cache for a provided cache key.If a sync is already in progress on the end point for this associated cache. a response communicating this is returned.
  • No labels