Comments (7)
I'd love to see this implemented as well. Currently is there any easy way to set certain pages not to cache?
I also think the default should be not to cache any wp-admin urls
from batcache.
Currently is there any easy way to set certain pages not to cache?
We use code like this:
if ( $_SERVER['HTTP_HOST'] == 'SomeSiteWeDontWantToCache.com' ) {
$batcache['max_age'] = 0;
}
You could check for anything, including path or the existence of a specific cookie (which we also do).
I also think the default should be not to cache any wp-admin urls
Logged in users aren't served cached pages:
https://github.com/Automattic/batcache/blob/master/advanced-cache.php#L333-L341
from batcache.
Another good example
https://github.com/Automattic/vip-quickstart/blob/master/www/config/batcache-config.php#L58-L82
from batcache.
My method is a bit simpler. I'm using it on a few sites to allow the DONOTCACHEPAGE constant to abort caching. Just submitted a PR. Adding this would really help with plugin compatibility. More plugin developers seem to be using it to address issues discovered with W3TC and WP Super Cache.
from batcache.
This feature is a duplicate ( even tri-plicate? ) of functionality we already have. I'd add the batcache_cancel() function to the list as well.
from batcache.
I think you may be missing the point here. Yes, Batcache already supports ways to abort the cache, but these "features" you're referring to requires additional configuration on a per site basis.
The idea here was to just let Batcache natively support a popular constant to trigger the cancelation. Both W3TC and WP SuperCache check for DONOTCACHEPAGE
, so many plugins like WooCommerce for example will simply look for that constant and abort the cache when needed.
If Batcache just supported it out of the box, there would be less per site configuration when setting up plugins that are already doing some caching conflict resolution out of the box based on DONOTCACHEPAGE
Please reconsider. Thanks!
from batcache.
Is there anyway we can exclude asset files like .js
from Batcache?
I cant find a way to make the below snippet work.
https://github.com/Automattic/vip-quickstart/blob/master/www/config/batcache-config.php#L58-L82
if ( substr($_SERVER['REQUEST_URI'], -3) == '.js' ) {
$batcache['max_age'] = 0; // disable batcache
}
from batcache.
Related Issues (20)
- Trying to access array offset on value of type bool
- Avoid caching conflicts with plugins creating specific views with JSON requests HOT 9
- Bad cookie default configuration disabling cache when not needed
- Undefined index and property notices HOT 2
- Composer support HOT 1
- Uncompatible to Jetpack_is_mobile HOT 6
- set $seconds = 0 in the batcache class and could not find 'served from batcache in xxx seconds' HOT 1
- Cache flush rules
- No clear all method HOT 1
- Improve batcache manager HOT 1
- normalize versions and update changelog HOT 1
- Exempt PUT, PURGE, and DELETE requests HOT 1
- nginx Headers Not Getting Cached
- No Batcache stats in head HOT 1
- missing object_cache result in some warnings HOT 1
- create_function() is deprecated in PHP 7.2 HOT 2
- can advanced-cache.php be somewhere else? HOT 1
- Where should I submit an issue - here or on WP.ORG?
- Breaking the cache? Any function, callback filter etc.
- The "generated in" comment doesn't appear in the page source for sub sites in a network install but it does appear in the page source for the main site HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from batcache.