Cache Loading
/**
* Get some blog categories from the database or cache
*/
function getCategories(){
var cacheKey = "q-blog-categories";
//Check if data exists
local.data = cache.get( cacheKey );
if( !isNull( local.data ) ){
return local.data;
}
// Else query DB and cache
var data = blogDAO.getCategories();
cache.set(cacheKey, data, 120, 20);
return data;
}Was this helpful?