@@ 1239-1241 (lines=3) @@ | ||
1236 | } while( 0 ); |
|
1237 | ||
1238 | // Expire old keys |
|
1239 | foreach ( $stats_cache as $k => $cache ) |
|
1240 | if ( !is_array( $cache ) || 300 < time() - key($cache) ) |
|
1241 | unset( $stats_cache[$k] ); |
|
1242 | ||
1243 | // Set cache |
|
1244 | $stats_cache[$key] = array( time() => $stats_rows ); |
|
@@ 1337-1341 (lines=5) @@ | ||
1334 | $data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
1335 | ||
1336 | // Expire old keys |
|
1337 | foreach ( $stats_cache as $k => $cache ) { |
|
1338 | if ( ! is_array( $cache ) || ( 5 * MINUTE_IN_SECONDS ) < time() - key( $cache ) ) { |
|
1339 | unset( $stats_cache[ $k ] ); |
|
1340 | } |
|
1341 | } |
|
1342 | ||
1343 | // Set cache |
|
1344 | $stats_cache[ $cache_key ] = array( |