Last active
December 16, 2015 17:09
-
-
Save AtomicSmash/5468153 to your computer and use it in GitHub Desktop.
A simple transient testing setup. Saves the current time in the DB and resets it after 5 mins
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
//Get transient value. If it's expired it will return jolly sod all... | |
$teat = get_transient( 'cool_cache_name'); | |
//See what's in the variable | |
if($teat == ""){ | |
//Add the current time as a new transient, good value for testing. | |
//300 is equal to 5 minute - 60*60*12 is 12 hours | |
set_transient( 'cool_cache_name', date('G:i'), 300 ); | |
echo(date('G:i')); | |
}else{ | |
//If there is a transient in place, echo that puppy out. | |
echo($teat); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment