Created
January 29, 2019 13:50
-
-
Save putzflorian/8ffee1c1f4bc736c7650e205bf1dfa05 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$actual_hour = date('H'); | |
$condition[] = 'hour_' . $actual_hour; | |
$lifetime = 3600; // 1h | |
$mdCondition = md5($condition); | |
if (!Cache::load($mdCondition)) { | |
$objects->setOrderKey("RAND($actual_hour)", false); | |
Cache::save( | |
$objects, | |
$mdCondition, | |
[], | |
$lifetime); | |
} else { | |
p_r("im cache"); | |
$cachedObjects = Cache::load($mdCondition); | |
p_r($cachedObjects); | |
$objects = $cachedObjects; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment