pressjitsu / pj-page-cache-red Goto Github PK
View Code? Open in Web Editor NEWRedis-backed full page caching plugin for WordPress
License: GNU General Public License v3.0
Redis-backed full page caching plugin for WordPress
License: GNU General Public License v3.0
Hi!
Would it make any sense to support different compression levels for zlib? Default is 6, but perhaps 1 would be faster?
Also, I think zstd (levels 1-5) or lz4 would be a better choice of compression. Much much faster than zlib.
Please add a support for persistent connection, so instead using:
$redis->connect
we use
$redis->pconnect
Using persistent connection will not reinitialize redis driver on each request
So It will be faster.
Currently our plugin doing the cache clearing ourself (on shutdown). And when we want to get cache we get multiple keys (real value and locked value).
All of this makes redis not useful. For what we do all of this if redis already do that? Redis have LFU which is much more smart when deleting expired cache. We just need to pass ttl when setting the cache. And redis will take care of the rest.
For locking the key it still make sense. But we can optimize it by implementing redis way using either Redlock / SETNX / WATCH.
For deleting expired cache let redis do it.
When we compare our plugin with other similar page cache plugin (using redis) like WP Redis Cache. We left behind so much:
=> https://github.com/BenjaminAdams/wp-redis-cache
Then when comparing with disk cache, we even get similar result (redis is reading from ram, logically it should be much much much faster then reading from disk)
Now the benchmark: (100visits/sec for 10 minutes)
W3 Total Cache (disk basic cache): avg 365ms
Pressijitsu redis cache (localhost): avg 368 ms
WP redis cache (localhost): avg 41ms
Hi,
In the instructions
ln -s plugins/redis-page-cache/advanced-cache.php advanced-cache.php
should be
ln -s plugins/pj-page-cache-red/advanced-cache.php advanced-cache.php
Hello,
let's take for example the url (article post) https://domain.com/hello-world
for https://domain.com/hello-world
, x-pj-cache-status: hit
for https://domain.com/hello-world/
, x-pj-cache-status: miss
why is that
Hello,
Using your cache system for a week or 2 and really enjoy it, but one question remains, as the title of this issue stated...
I tried to had this line to the $request_hash
variable: 'user-agent' => ! empty( S_SERVER['HTTP_USER_AGENT'] ) ? S_SERVER['HTTP_USER_AGENT'] : ''
(I know it should generate a lot of db rows for a single page, but it's a temporary hack so...), but it did not seems to work as expected...
What do you think of this?
curl -v http://tide.local/ -o /dev/null
* Trying 127.0.0.1...
* TCP_NODELAY set
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0* Connected to tide.local (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: tide.local
> User-Agent: curl/7.50.3
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Fri, 20 Apr 2018 06:37:48 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< X-Powered-By: PHP/7.2.4
< X-Pj-Cache-Status: miss
<
{ [16148 bytes data]
100 16142 0 16142 0 0 3131 0 --:--:-- 0:00:05 --:--:-- 104k* Curl_http_done: called premature == 0
100 54281 0 54281 0 0 10529 0 --:--:-- 0:00:05 --:--:-- 351k
* Connection #0 to host tide.local left intact
Any ideas on what to try based on the message I keep getting back from the curl
request?
When users logout they'll still see different cache buckets due to the uniqueness of some wp-settings-*
cookies used only in the admin panel. We can safely ignore these cookies to increase the cache hit-rate for users that may have been logged in at some point.
Do you have any advise how partial cookie names could be ignored?
Piwik and Iubenda use such (e.g., _pk_id.1.ee8a, and _iub_cs-819208 accordingly). In these cases, only the prefix should be selected.
I'm not sure where the pj_sapi_headers_clean()
function is suppose to be coming from, it definitely doesn't exist in the plugin. However, it's being referenced in two places pj-page-cache.php#L146 & pj-page-cache.php#L162. Could you explain what the function does and how to get it?
Hello,
First of all thanks for this really cool caching plugin for Wordpress!
I'm facing a weird behavior on a website using AWS Beanstalk and Elasticache (Redis version of course) as the hit
is only showing up on the second refresh of the same page...
Does it sounds like a bug or a misconfiguration for you?
Thanks for any tip and/or trick about that...
Hey,
have you thought about adding a Fragment Cache/Hole Punch capability?
I'm think of building a fragment cache solution so it can be used with (more) dyamic webshops based on woocommerce too (whereby we take the Fragment Cache capiability/Fragment marker from W3TC).
Do you have any plans for this? (so there might not be duplicate work)
Hi guys,
Thanks for the excellent drop-in, could you please add composer support?
Thanks,
E
It would be great to be able purge the cache from the Wordpress admin, even in the manner of WP-Redis https://github.com/pantheon-systems/wp-redis/wiki for which the developer can add code to the functions.php of the Theme
I upgraded my server from PHP 5.6 to PHP 7.2, and its no longer caching via Redis. I checked, and it is requesting the page from Redis, but its no longer sending the cached page to Redis.
Any ideas?
Might have misunderstood but I placed redis-page-cache-config.php in WP root (not /wp-content) and added the_a few variables. All that happens is that the variables are displayed in text at the top of the website.
Sometimes due to a cache hit, the wordpress_test_cookie
cookie on wp-login.php
is not set, causing a failure when attempting to login for the first time.
It looks like there's a TTL setting available for this plugin, but it's only used for internal calculations. There is no TTL passed to Redis, so each page is cached indefinitely. That seems to be why the allkeys-lru
eviction policy is recommended.
With our current automation, we're not able to easily change this eviction strategy from the default, which does not evict any keys that do not have a TTL set. Is there any reason that this plugin couldn't optionally set the TTL in Redis?
Hi, have anyone used this plugin with the likes of WooCommerce?
Does it play well?
thank you
Hello.
How can I clear/disable the cache on a specific URL?
Is it possible in functions.php for instance?
Thanks in advance.
Example: http://domain.com/done
need exclude /done link
Hi,
I want to modify only a part of the html of a page when I consider it's expired and store the result html in cache.
Is there a hook or something to check cached html and edit it before page loads?
Thanks
Hello
On our multisite, I am tracing the issue of video not playing in Safari After wildcard SSL setup.
Here is a video for your test,
https://lovcour.com/testvideo/testvideo.hyperesources/mp4_video.mp4
which I uploaded by ftp, that means the issue is not related to wordpress.
Here is the screenshot in Safari Console, and it show video is not cached:
and here is cache setting in redis-hhvm.conf
cat /etc/nginx/common/redis-hhvm.conf
set $skip_cache 0;
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != “”) {
set $skip_cache 1;
}
if ($request_uri ~* “(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(index)?.xml|[a-z0-9-]+-sitemap([0-9]+)?.xml)”) {
set $skip_cache 1;
}
#if ($request_uri ~* “(/forums/|/groups/|/members/|/activity|/blogs/|/messages/|/register/|/activate/|/bpactivity/|/bp-portfolio-projects/|/bpgroup/|/activities/|/bp-social-articles.*|/bpmember/)”) {
if ($request_uri ~* “(/bpmember/)”) {
set $skip_cache 1;
}
if ($request_uri ~* “(/lovcourshow/|/ishsow/)”){
set $skip_cache 1;
}
if ($request_uri ~* “(/wechat-authorize-remote.php)”) {
set $skip_cache 1;
}
if ($request_uri ~* “(/cross-domain.php)”) {
set $skip_cache 1;
}
if ($http_cookie ~* “comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart”) {
set $skip_cache 1;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location /redis-fetch {
internal ;
set $redis_key $args;
redis_pass redis;
}
location /redis-store {
internal ;
set_unescape_uri $key $arg_key ;
redis2_query set $key $echo_request_body;
redis2_query expire $key 36000;
redis2_pass redis;
}
location ~ .php$ {
set $key “nginx-cache:$scheme$request_method$host$request_uri”;
try_files $uri =404;
srcache_fetch_skip $skip_cache;
srcache_store_skip $skip_cache;
srcache_response_cache_control off;
set_escape_uri $escaped_key $key;
srcache_fetch GET /redis-fetch $key;
srcache_store PUT /redis-store key=$escaped_key;
more_set_headers ‘X-SRCache-Fetch-Status $srcache_fetch_status’;
more_set_headers ‘X-SRCache-Store-Status $srcache_store_status’;
include fastcgi_params;
fastcgi_param HTTP_ACCEPT_ENCODING “”;
fastcgi_pass hhvm;
}
I would like to ask your professional instruction on know how to set the redis cache rules to make the video playing?
Thanks in advance, and have a nice day.
Alex
This plugin has worked great for me before WP 4.7, since the core introduces a new handling of actions/filters based in the WP_Hook class, fortunately I'm now using NginX micro-cache.
https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/
Specifically direct access to the $wp_filter
global now produces a fatal error since for every tag there is now a single WP_Hook object instead of the nested array of previous versions.
Hi Is this WP plugin still maintained? I see your wP plugin page, not updated since 3 major release
Hi guys,
Could you please tag the releases?
Thanks,
E
Hi their,
I just installed your plugin and it seems like it does not work for me :(
Here is what the curl gives me:
Server: nginx
< Date: Wed, 14 Dec 2016 11:43:05 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/5.6.29
< X-Pj-Cache-Status: miss
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Link: https://url..../wp-json/; rel="https://api.w.org/", https://url.....de/?p=1006; rel=shortlink
< Set-Cookie: PHPSESSID=dihuh83z2rz2rh2i6; path=/
< Vary: Accept-Encoding
< X-Powered-By: PleskLin
Hi! Is it possible to use a unix socket instead of tcp?
Apparently the PHPRedis supports it: https://github.com/phpredis/phpredis#connection
I simply did this. Not sure it is correct. Without the port set it failes with a PHP error message.
private static $redis_host = '/tmp/redis.sock';
private static $redis_port = '0';
// private static $redis_host = '127.0.0.1';
// private static $redis_port = 6379;
Hi, Its really great concept. Is there any way to add feature to use remote redis instead localhost? And ability to use custom "redis database id" will be good
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.