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

Considerations with Quick Cache plugin #14

Closed
bryant1410 opened this issue Apr 19, 2014 · 7 comments
Closed

Considerations with Quick Cache plugin #14

bryant1410 opened this issue Apr 19, 2014 · 7 comments

Comments

@bryant1410
Copy link
Contributor

I noticed that using tables in a wordpress page and having Quick Cache plugin activated it gets in conflict when I make a change in a table (visitors see old table info).

Is the cache info being invalidated when a table changes? Quick Cache provides a sort of mini-API with operations like this one:

$_SERVER['QUICK_CACHE_ALLOWED'] = FALSE;
@TobiasBg
Copy link
Member

Thanks for your report! I wouldn't necessarily call this a conflict, but just something that needs to be considered when using caching.
TablePress can indeed clear the cache of a caching plugin (and it does that for three commonly used caching plugins). However, from what I can see from a quick glance at the Quick Cache plugin page, it only seems to have a "mini-API" to prevent caching on a page. That's obviously not what we want. Do you maybe know if there also a function to clear the Quick Cache cache?

@bryant1410
Copy link
Contributor Author

Wow, what a quick response! I was thinking the same, if there is or not a cache invalidate for a certain group or pages, or something like that. I don't know. I'm gonna search a little.

What I know is the following, which appears in Quick Cache WP settings page:

Developing a Theme or Plugin for WordPress?

Tip: Quick Cache can be disabled temporarily. If you're a theme/plugin developer, you can set a flag within your PHP code to disable the cache engine at runtime. Perhaps on a specific page, or in a specific scenario. In your PHP script, set: $_SERVER['QUICK_CACHE_ALLOWED'] = FALSE; or define('QUICK_CACHE_ALLOWED', FALSE). Quick Cache is also compatible with: define('DONOTCACHEPAGE', TRUE). It does't matter where or when you define one of these, because Quick Cache is the last thing to run before script execution ends.

Writing "Advanced Cache" Plugins Specifically for Quick Cache

Theme/plugin developers can take advantage of the Quick Cache plugin architecture by creating PHP files inside this special directory: /wp-content/ac-plugins/. There is an example plugin file @ GitHub (please review it carefully and ask questions). If you develop a plugin for Quick Cache, please share it with the community by publishing it in the plugins respository at WordPress.org.

Why does Quick Cache have it's own plugin architecture? WordPress loads the advanced-cache.php drop-in file (for caching purposes) very early-on; before any other plugins or a theme. For this reason, Quick Cache implements it's own watered-down version of functions like add_action(), do_action(), add_filter(), apply_filters().

@TobiasBg
Copy link
Member

No problem! :-)
Yes, that's also the information that I found, but that's not really what we should be doing here. There's no need to prevent caching on pages with tables at all. What we would need is a method to flush the cache whenever a table is edited (that's also what the plugin does with the other caching plugins).

@bryant1410 bryant1410 changed the title Conflicts with Quick Cache plugin Considerations with Quick Cache plugin Apr 19, 2014
@bryant1410
Copy link
Contributor Author

What about this? https://github.com/WebSharks/Quick-Cache/wiki/Clearing-the-Cache-Dynamically

It seems to clear all the cache, but appears to be the only method available.

@TobiasBg
Copy link
Member

That's perfect! Nice find! I'll add that to TablePress shortly.

@bryant1410
Copy link
Contributor Author

Thank you very much @TobiasBg

@TobiasBg
Copy link
Member

No problem, you are very welcome! :-) Good to hear that this will be helpful!
If you want, you can benefit from this by installing TablePress 1.4 again from a fresh download, where I just added this feature, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants