keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

update cache size transient #269

Closed coreykn closed 3 years ago

coreykn commented 3 years ago

Update the cache_enabler_cache_size transient to expire after 1 day instead of 1 hour. This will help the new real-time cache size handling perform better on low traffic sites with the cache being regularly generated. For sites that have every page cached this transient would expire after 1 day and then only be rebuilt when displayed in the WordPress dashboard. Based on the feedback we can adjust this value and/or add a filter hook.

Update the Cache_Enabler::on_cache_created_cleared() method to always set the transient when the cache size has changed (instead of only if $new_cache_size is greater than or equal to 0). The cache size never goes negative, but let us be strict and validate what is being set.

This updates what was added in PR #237.