{"id":8164763,"date":"2016-09-09T16:31:34","date_gmt":"2016-09-09T16:31:34","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/delete-object-cache-memcache\/"},"modified":"2016-09-09T16:31:34","modified_gmt":"2016-09-09T16:31:34","slug":"delete-object-cache-memcache","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/delete-object-cache-memcache\/","title":{"rendered":"Delete Object Cache (Memcache)"},"content":{"rendered":"<p>Love this plugin, but one little bug, if you are using an external object cache (like APC or Memcache) and  you look at your posts list and see a missing featured image, then you add one, the list still shows that you don&#8217;t have a featured image (or if you change one it shows the old).   This is due to caching. I created this simple function for my functions file to solve it.  It&#8217;d be great if you can integrate this into your code:<\/p>\n<p>\/***<br \/>\n*<br \/>\n* ADMIN: Clear cache for featured image column plugin when new featured image<br \/>\n*  only useful as long as featured image column plugin is active<br \/>\n* could be a conditional to check if meta_key=_thumbnail_id, but figured the lookup isn&#8217;t worth it, just delete the cache on all post meta updates for a post<br \/>\n*<br \/>\n****\/<\/p>\n<p>function fic_thumbnail_updated_actions($meta_id, $post_id) {<\/p>\n<p>\t$post_id\t= (int) $post_id;<br \/>\n\t$cache_key\t= &#8220;featured_image_post_id-{$post_id}-_thumbnail&#8221;;<br \/>\n\t$cache\t\t= wp_cache_delete( $cache_key, null );<\/p>\n<p>}<br \/>\nadd_action( &#8216;deleted_post_meta&#8217;, &#8216;fic_thumbnail_updated_actions&#8217;, 10, 2 );<br \/>\nadd_action( &#8216;updated_post_meta&#8217;, &#8216;fic_thumbnail_updated_actions&#8217;, 10, 2 );<br \/>\nadd_action( &#8216;added_post_meta&#8217;,   &#8216;fic_thumbnail_updated_actions&#8217;, 10, 2 );<\/p>\n","protected":false},"template":"","class_list":["post-8164763","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/8164763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/8164763\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=8164763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}