| @@ -10,10 +10,15 @@ | ||
| 10 | 10 | * |
| 11 | 11 | * @var array |
| 12 | 12 | */ |
| 13 | 13 | private static $cache_map = []; |
| 14 | - | |
| 15 | 14 | /** |
| 15 | + * Reset the memory cache. | |
| 16 | + */ | |
| 17 | + public static function reset() { | |
| 18 | + self::$cache_map = []; | |
| 19 | + } | |
| 20 | + /** | |
| 16 | 21 | * Get the cached attachment ID. |
| 17 | 22 | * |
| 18 | 23 | * @param string $url the URL of the attachment. |
| 19 | 24 | * |
| @@ -53,9 +58,8 @@ | ||
| 53 | 58 | $expiration = $id === 0 ? ( 10 * MINUTE_IN_SECONDS ) : WEEK_IN_SECONDS; |
| 54 | 59 | wp_using_ext_object_cache() |
| 55 | 60 | ? wp_cache_set( $cache_key, $id, self::CACHE_GROUP, $expiration ) |
| 56 | 61 | : set_transient( self::CACHE_GROUP . $cache_key, $id, $expiration ); |
| 57 | - | |
| 58 | 62 | } |
| 59 | 63 | |
| 60 | 64 | /** |
| 61 | 65 | * Generate cache key for URL. |