Skip to content

Commit

Permalink
Add filter to allow cache locking to be disabled.
Browse files Browse the repository at this point in the history
See #387
  • Loading branch information
raamdev committed Dec 27, 2014
1 parent ed2fc28 commit de2148f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion quick-cache/includes/share.php
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ public function delete_all_files_dirs_in($dir, $delete_dir_too = FALSE)
*
* @since 140422 First documented version.
*
* @return array Lock type & resource handle needed to unlock later.
* @return array Lock type & resource handle needed to unlock later or FALSE if disabled by filter.
*
* @throws \exception If {@link \sem_get()} not available and there's
* no writable tmp directory for {@link \flock()} either.
Expand All @@ -1801,6 +1801,9 @@ public function delete_all_files_dirs_in($dir, $delete_dir_too = FALSE)
*/
public function cache_lock()
{
if((boolean)apply_filters('quick_cache_disable_cache_locking', FALSE))

This comment has been minimized.

Copy link
@jaswrks

jaswrks Dec 27, 2014

This should be if(apply_filters(__CLASS__.'_disable_cache_locking', FALSE)) so that it will continue to be supported in ZenCache; i.e. so that the mapping in ZenCache will continue to support the old Quick Cache hook names.

In ZenCache, this call should be if($this->apply_wp_filters(__CLASS__.'_disable_cache_locking', FALSE))

The same would apply to line 1837 also, where you check the same hook.

return false;

if(!($wp_config_file = $this->find_wp_config_file()))
throw new \exception(__('Unable to find the wp-config.php file.', $this->text_domain));

Expand Down Expand Up @@ -1831,6 +1834,9 @@ public function cache_lock()
*/
public function cache_unlock(array $lock)
{
if((boolean)apply_filters('quick_cache_disable_cache_locking', FALSE))
return;

if(!is_array($lock))
return; // Not possible.

Expand Down

0 comments on commit de2148f

Please sign in to comment.