Skip to content

Commit

Permalink
fix object cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
asadowski10 committed Oct 13, 2021
1 parent 961a1ee commit f675c88
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 3.1.5 - 13 Oct 2021
- Fix object cache key with different $args for the same image and location

## 3.1.4 - 24 Sept 2021
- Update `ari_responsive_image_caption` filter to add attachment id and attachment attributes params
- Fix depecrated_function with check WordPress version
Expand Down
4 changes: 2 additions & 2 deletions advanced-responsive-images.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Advanced Responsive Images
Version: 3.1.4
Version: 3.1.5
Plugin URI: https://github.com/asadowski10/advanced-responsive-images
Description: WordPress plugin to implement custom HTML markup for responsive images
Author: Alexandre Sadowski
Expand All @@ -19,7 +19,7 @@
}

// Plugin constants
define( 'ARI_VERSION', '3.1.4' );
define( 'ARI_VERSION', '3.1.5' );
define( 'ARI_MIN_PHP_VERSION', '5.4' );
define( 'ARI_VIEWS_FOLDER_NAME', 'ari' );

Expand Down
5 changes: 3 additions & 2 deletions classes/modes/picture-lazyload.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public function render_image( $html = '' ) {
}

$found = false;
$data = wp_cache_get( $this->attachment_id . '-' . $this->args['data-location'], '', false, $found );
$key = md5( maybe_serialize( $this->args ) );
$data = wp_cache_get( $this->attachment_id . '-' . $key, '', false, $found );
if ( ! empty( $found ) ) {
return $data;
}
Expand Down Expand Up @@ -149,7 +150,7 @@ public function render_image( $html = '' ) {

], $content_with_caption );

wp_cache_set( $this->attachment_id . '-' . $this->args['data-location'], $image, '' );
wp_cache_set( $this->attachment_id . '-' . $key, $image, '' );

return $image;
}
Expand Down

0 comments on commit f675c88

Please sign in to comment.