Skip to content

Instantly share code, notes, and snippets.

@bigdawggi
Created February 1, 2013 18:52
Show Gist options
  • Save bigdawggi/4693237 to your computer and use it in GitHub Desktop.
Save bigdawggi/4693237 to your computer and use it in GitHub Desktop.
Quick and dirty cache expiration testing. I placed in functions.php just for a quick place to put it. Refresh the page, and it should change every 10 seconds.
<?php
if (isset($_GET['matt'])) {
$cur_time = time();
$cache = wp_cache_get('matt-time', 'matt');
if ($cache !== false) {
echo '<pre>Found'.print_r($cache, 1).'</pre>';
}
else {
wp_cache_set('matt-time', $cur_time, 'matt', 10);
$cache = wp_cache_get('matt-time', 'matt');
echo '<pre>Setting'.print_r($cache, 1).'</pre>';
}
die();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment