Skip to content

Commit 12cd420

Browse files
committed
add reset for memory cache
1 parent e1c1780 commit 12cd420

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

inc/attachment_cache.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ class Optml_Attachment_Cache {
1111
* @var array
1212
*/
1313
private static $cache_map = [];
14-
14+
/**
15+
* Reset the memory cache.
16+
*/
17+
public static function reset() {
18+
self::$cache_map = [];
19+
}
1520
/**
1621
* Get the cached attachment ID.
1722
*

tests/test-media.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ public function test_replace_alternative_domain(){
418418
$this->assertEquals( $this->attachment_url_to_post_id( $scaled_url ), self::$sample_attachment_scaled );
419419
}
420420
public function test_replace_urls_in_editor_content() {
421+
Optml_Attachment_Cache::reset();
421422
// Sample attachment:
422423
$original_url = Optml_Media_Offload::get_original_url( self::$sample_attachement );
423424
$extension = pathinfo( $original_url, PATHINFO_EXTENSION );

0 commit comments

Comments
 (0)