Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Coldbox Cache Error
public function incident(event){
var cacheKey = "";
//Check if incident exists in cache
if(cache.lookup( cacheKey ) ){
return cache.get( cacheKey );
//incident isn't in the cache
rc.httpResource = "myendpoint/";
local.callResult = api.send(argumentCollection=rc);
if(local.callresult.responseheader.status_code == 200){
local.incident = deserializeJSON(local.callResult.rawResponse);
//check to see if the incident is active
//if it isn't cache it
if( EQ 0){
cache.set(cacheKey, local.callResult.rawResponse, 120, 20);
return local.incident;
prc.errorsArr = local.callresult.response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment