Created
December 4, 2016 13:38
-
-
Save moghanbari/4954eb07de8504923be31a8bd63efb98 to your computer and use it in GitHub Desktop.
How to Work With Cache In Wordpress
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 | |
function get_from_cach() | |
{ | |
$c = wp_cache_get("my_cache_whatever_name", null); | |
if($c == null) | |
{ | |
$c = $my_cache_whatever_value; | |
wp_cache_set( "my_cache_whatever_name", $c, null, 1000); // Last Number is Time In Minutes | |
} | |
return $c; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment