qEngine support a database cache, called qCache. Caching is very easy with qCache.
1. First, store the cached contents by qcache_update:
function qcache_update ($id, $content)
$id = unique ID.
$content = cached content.
2. Then get the cached content from the database:
function qcache_get ($id)
$id = the unique ID.
$cmd = post_param ('cmd');
// try to get the cache
$content = qcache_get ('mycache');
// fill with usual code, including mysql query, etc
// to prove this is cached, we are using randomizer
// if it's not cached, randomizer should always be changed.
$sess = random_str(16).'-'.getmicrotime ();
$content = "<h1>This is a Content</h1>\n";
$content = "<p>It's now: $sess</p>\n";
// the store the content
qcache_update ('mycache', $content);
Subscribe to our newsletter for the latest updates and exciting promo!