Skip to content

Instantly share code, notes, and snippets.

@nolandubeau
Created October 18, 2012 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nolandubeau/3914533 to your computer and use it in GitHub Desktop.
Save nolandubeau/3914533 to your computer and use it in GitHub Desktop.
CacheBoxProvider / JDBC Store and Null values
//Test.cfc handler
//Running on Coldbox 3.5.1, Adobe CF 9.0.2
component output="false"{
property name="cache" inject="cachebox:database";
// HTTP Security
this.allowedMethods = {};
function index(event){
var rc = event.getCollection();
local.cacheKey = "user-tom-foolery";
local.user = {};
local.user.name = "Tom Foolery";
local.user.email = "funny@businesscorp.com";
local.user.age = javaCast("null",0);
//dump out the user, struct will contain the null key
writedump(local.user);
//set the user into cache
cache.set(local.cacheKey,local.user, 10, 20);
//dump out the cached user, struct will not contain the null key
if(cache.lookup( local.cacheKey ) ){
writedump(cache.get( local.cacheKey ));
}
abort;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment