Skip to content

Instantly share code, notes, and snippets.

@rythie
Created December 10, 2012 21:47
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 rythie/4253674 to your computer and use it in GitHub Desktop.
Save rythie/4253674 to your computer and use it in GitHub Desktop.
ezSQL cache test case
<?php
// Standard ezSQL Libs
include_once "shared/ez_sql_core.php";
include_once "mysql/ez_sql_mysql.php";
// Initialise singleton
$db = new ezSQL_mysql('db_user', 'db_pass', 'db_name');
// Cache expiry
$db->cache_timeout = 1; // Note: this is hours
// Specify a cache dir. Path is taken from calling script
$db->cache_dir = 'ezsql_cache';
// (1. You must create this dir. first!)
// (2. Might need to do chmod 775)
// Global override setting to turn disc caching off
// (but not on)
$db->use_disk_cache = true;
// By wrapping up queries you can ensure that the default
// is NOT to cache unless specified
$db->cache_queries = true;
// At last.. a query!
$results = $db->get_results("SELECT SLEEP(10)");
print_r($results);
//$db->debug();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment