Created
December 10, 2012 21:47
-
-
Save rythie/4253674 to your computer and use it in GitHub Desktop.
ezSQL cache test case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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