| @@ -317,14 +317,11 @@ | ||
| 317 | 317 | if ( WP_FS__DEV_MODE || $this->_api->IsSandbox() ) { |
| 318 | 318 | $flush = true; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - $has_valid_cache = self::$_cache->has_valid( $cache_key, $expiration ); | |
| 322 | - $cached_result = $has_valid_cache ? | |
| 323 | - self::$_cache->get( $cache_key ) : | |
| 324 | - null; | |
| 321 | + $cached_result = self::$_cache->get( $cache_key ); | |
| 325 | 322 | |
| 326 | - if ( $flush || is_null( $cached_result ) ) { | |
| 323 | + if ( $flush || ! self::$_cache->has_valid( $cache_key, $expiration ) ) { | |
| 327 | 324 | $result = $this->call( $path ); |
| 328 | 325 | |
| 329 | 326 | if ( ! is_object( $result ) || isset( $result->error ) ) { |
| 330 | 327 | // Api returned an error. |
| @@ -354,11 +351,9 @@ | ||
| 354 | 351 | } |
| 355 | 352 | } |
| 356 | 353 | } |
| 357 | 354 | |
| 358 | - if ( is_numeric( $expiration ) ) { | |
| 359 | - self::$_cache->set( $cache_key, $result, $expiration ); | |
| 360 | - } | |
| 355 | + self::$_cache->set( $cache_key, $result, $expiration ); | |
| 361 | 356 | |
| 362 | 357 | $cached_result = $result; |
| 363 | 358 | } else { |
| 364 | 359 | $this->_logger->log( 'Using cached API result.' ); |