@@ 1217-1219 (lines=3) @@ | ||
1214 | } while( 0 ); |
|
1215 | ||
1216 | // Expire old keys |
|
1217 | foreach ( $stats_cache as $k => $cache ) |
|
1218 | if ( !is_array( $cache ) || 300 < time() - key($cache) ) |
|
1219 | unset( $stats_cache[$k] ); |
|
1220 | ||
1221 | // Set cache |
|
1222 | $stats_cache[$key] = array( time() => $stats_rows ); |
|
@@ 1315-1319 (lines=5) @@ | ||
1312 | $data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
1313 | ||
1314 | // Expire old keys |
|
1315 | foreach ( $stats_cache as $k => $cache ) { |
|
1316 | if ( ! is_array( $cache ) || ( 5 * MINUTE_IN_SECONDS ) < time() - key( $cache ) ) { |
|
1317 | unset( $stats_cache[ $k ] ); |
|
1318 | } |
|
1319 | } |
|
1320 | ||
1321 | // Set cache |
|
1322 | $stats_cache[ $cache_key ] = array( |