Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database Cache: delete cache function doesn't work when object-cache (memcache etc.) is enabled #152

Open
PixelbarEupen opened this issue Mar 15, 2018 · 1 comment
Labels

Comments

@PixelbarEupen
Copy link

$wpdb->query( 'DELETE FROM `' . $wpdb->options . "` WHERE `option_name` LIKE ('\_transient%.cachify')" );

The DB cache relies on transients that are automatically cached in the object cache (if enabled) like memcache(d), redis etc...

Your delete function makes a query for all transients to delete the afterwards. But when object-cache is enabled, no transients are stored in the database, so the cache won't be cleared.

This issue is explained here: https://css-tricks.com/the-deal-with-wordpress-transients/#article-header-id-23

So, wp_cache_flush(); would be the correct function, but it will delete the whole cache... not only the cachify-transients.

@derweili
Copy link

So as I understand, there are two options:

  1. We delete the whole object cache
    This will flush all data stored in the object cache from all plugins not only from cachify.

  2. We store a master transient which includes an array of all cached pages. This list of cached pages is later used to delete the cached files one by one.
    On large websites with several hundred pages this would be a lot of data stored in the master transient. I'm not sure if this is a good idea.

If it doesn't cause any more problems, variant 1 would be fine. Since transients mostly contain some kind of cache I wouldn't have a problem with the Cachify "flush cache" button flushing the cache of other plugins as well.

@Zodiac1978 Zodiac1978 added the bug label Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants