Wegwarte
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Super Cache] Empty cache directoriesI haven’t disabled wp-cron by inserting “define(‘DISABLE_WP_CRON’, true);” into the wp-config.php file, but since my site doesn’t have many visits, and my server doesn’t provide cron jobs, I set up a cron job on a local Raspberry Pi to trigger wp-cron every minute:
* * * * * wget -O- https://mydomain.com/wp-cron.php > /dev/null
Forum: Plugins
In reply to: [WP Super Cache] Empty cache directoriesWell, maybe it’s a server issue, but I didn’t see this problem with an other cache plugin. When the issue occured, no other cache plugin was installed which could have interfered with WP Super Cache.
I need a preloaded cache because my site is really slow. Without cached pages, loading a page took 5 seconds sometimes; with cache (static HTML files) only fractions of a second. Maybe this was the reason my site wasn’t found by Google, while another site without WordPress & PHP & DB on the same server is well indexed, even without any special SEO.
- This reply was modified 2 years, 2 months ago by Wegwarte.
Forum: Plugins
In reply to: [WP Super Cache] Empty cache directoriesThe garbage collection was deactivated (0 seconds). And in the garbage collection section of the settings, there was a warning that supercache files aren’t removed because preload is activated.
Meanwhile I’m using a bash script to rebuild the cache files for all posts automatically every hour (iterating through the post URLs from the sitemap.xml and calling wget on each URL).
Forum: Plugins
In reply to: [WP Fastest Cache] How to clear the cache for a specific URL?Thanks, but unfortunately this won’t work for me since I have to control the cache from another server.
Forum: Plugins
In reply to: [WP Fastest Cache] How to automatically rebuild preloaded cache at 1pm?Thanks; but I know the crontab syntax.
I have now come to an own preload solution: A bash script (rebuild-cache.bash) which parses the sitemap.xml and gets every post URL in a loop. This way the entire cache for all posts is rebuild within 4 minutes.
#!/bin/bash > sitemap.xml wget -O- "https://mydomain.com/sitemap.xml" > sitemap.xml 2> wget.err if [ "$?" -ne 0 ] then echo "Error getting sitemap.xml: $(<wget.err)" exit 1 fi for urlSubmap in
cat sitemap.xml | grep '<loc>' | awk -F'[\<\>]' '{print $3}'
do echo "Submap: $urlSubmap" wget -O- "$urlSubmap" > submap.xml 2> wget.err if [ "$?" -ne 0 ] then echo "Error getting $urlSubmap: $(<wget.err)" exit 1 fi for urlPost incat submap.xml | grep '<loc>' | awk -F'[\<\>]' '{print $3}'
do echo "Post: $urlPost" wget -O- "$urlPost" > post.html 2> wget.err if [ "$?" -ne 0 ] then echo "Error getting $urlPost: $(<wget.err)" fi done doneAnother bash script (clear-cache.bash) clears the cache:
#!/bin/bash > wget.out wget -O- "https://mydomain.com/?action=wpfastestcache&type=clearcacheandminified&token=xyz123" > wget.out 2> wget.err if [ "$?" -ne 0 ] then echo "Error clearing cache: $(<wget.err)" exit 1 fi RESULT=$(<wget.out) if [ "$RESULT" != 'Done' ] then echo "Error clearing cache: $RESULT" exit 1 fi echo "Cache cleared sucessfully."
Both scripts are executed by cron:
0 0 * * * ~/clear-cache.bash > clear-cache.log 1 * * * * ~/rebuild-cache.bash > rebuild-cache.log
At 0:00 pm the cache is cleared, and every hour (0:01, 1:01, …) it is rebuilt.
Since I don’t have cron on the shared webserver whith the WordPress installation, the scripts are running on a Raspberry Pi (which I’m using as a “Pi-Hole”).
So far this solution is working for me. If there’s an easier solution using built-in features of WP Fastest Cache to achieve the same, then please tell me…