|
@@ 1229-1231 (lines=3) @@
|
| 1226 |
|
} while( 0 ); |
| 1227 |
|
|
| 1228 |
|
// Expire old keys |
| 1229 |
|
foreach ( $stats_cache as $k => $cache ) |
| 1230 |
|
if ( !is_array( $cache ) || 300 < time() - key($cache) ) |
| 1231 |
|
unset( $stats_cache[$k] ); |
| 1232 |
|
|
| 1233 |
|
// Set cache |
| 1234 |
|
$stats_cache[$key] = array( time() => $stats_rows ); |
|
@@ 1327-1331 (lines=5) @@
|
| 1324 |
|
$data = json_decode( wp_remote_retrieve_body( $response ) ); |
| 1325 |
|
|
| 1326 |
|
// Expire old keys |
| 1327 |
|
foreach ( $stats_cache as $k => $cache ) { |
| 1328 |
|
if ( ! is_array( $cache ) || ( 5 * MINUTE_IN_SECONDS ) < time() - key( $cache ) ) { |
| 1329 |
|
unset( $stats_cache[ $k ] ); |
| 1330 |
|
} |
| 1331 |
|
} |
| 1332 |
|
|
| 1333 |
|
// Set cache |
| 1334 |
|
$stats_cache[ $cache_key ] = array( |