![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
-
AuthorPosts
-
March 21, 2022 at 6:13 pm #1345384
I did look and many topics were quite old so I wanted to know, based on v4.9+, WordPress 5.9.2+, and PHP 7.4+, what is considered the best practice when dealing with a server that has Redis Cache enabled? I saw there were a lot of anomalies with the Post CSS file that is generated. In some situations the file would have been deleted but the object cache still says the CSS file exists causing the page to load without the proper CSS.
I do see there is few Advanced Settings within Enfold to try and fix WordPress Object Cache bugs, but that seemed more related to files being generated non-stop but this seems to be a different issue. But even if this is similar, the names for the fixes don’t seem very self-explanatory. I also see there is an option to disable the Post CSS file generation in the first place.
So what I would like to know is what is the best way to handle this situation? Is it easier/better to just disable the Post CSS file generation? Is there no real significant impact there? Or is it better to use one of the options in the Advanced Settings, and if so, which one?
== Theme Settings -> Performance -> Advanced Options ==
Unique timestamp of merged files and WP object cache bug:
– Add unique timestamps (= default)
– Disable adding unique timestamps only
– Fix WP bug, add unique timestamps
– Fix WP bug, disable unique timestamps== Disable Feature (in functions.php) ==
/**
* Filter to skip css file generation.
* You can add logic to skip for certain pages/posts only.
*
* @since 4.8.6.1
* @param boolean $create
* @return boolean true | false or anything else to skip generation of css file
*/
add_filter(‘avf_post_css_create_file’, ‘__return_false’);March 22, 2022 at 5:22 pm #1345558Hey lzevon,
To be honest I’ve not been working with a server that supports Redis.
But if you use file compression (merged css and/or js files via theme option) you must set
– Fix WP bug, add unique timestamps
– Fix WP bug, disable unique timestampsPlease check out what works for your install.
– Enable option “Delete old CSS and JS files?” on bottom of the Performance tab. Toggle theme options to force a rebuild of the merged files and check
inside WP upload folder ../uploads/dynamic_avia.– Load frontpages several times to check, that the files do not get generated on each page load. The content of the folder must not increase except the latest merged js and css files.
– Try again these steps several times to verify.
If you still encounter problems with the post css file and the setting above you have to disable creation of these files as mentioned above in function.php. In this case the content of the post css file is placed in inline style tags right before the element.
Best regards,
GünterMarch 22, 2022 at 9:18 pm #1345587Günter,
Thanks for replying, to answer your questions:
– “…if you use file compression” – We do not have that feature enabled on sites we use Enfold on. It is currently set to “Disable – no CSS file merging and compression” for both CSS and JS.
– “Enable option “Delete old CSS and JS files?”” – Done
– “Load frontpages several times to check…” – Did not see any extra files being generated in this after reloading the homepage a few times.
– “Try again these steps several times to verify.” – I’ll give it a shot, it’s not easily reproducible as it’s a de-sync between the cache (when it expires) and the database. So it may be a little bit to verify if this helps.
– “… you have to disable creation of these files…” – I didn’t get an answer on the type of performance impact this would cause on the site. What kind of impact should I expect in disabling this feature?I also have another question regarding “Delete old CSS and JS files” option. This is the description:
“Check if you want to delete expired CSS and JS files generated by the theme. Only recommended if you are NOT using a caching plugin (since a cached page might still use those files)”
It says this is only recommended if we’re not using a caching plugin, but we are using an object cache. Will that cause issues?March 22, 2022 at 11:30 pm #1345595Günter,
We ran into the error about an hour ago. Per your instruction I’ve disabled the CSS generation in the functions.php. Please let me know what kind of impact I should expect with this feature disabled.
March 23, 2022 at 11:24 am #1345643Hi,
Sorry for the confusion.
As you do not use js and css file compression (I thought you díd) than “Delete old CSS and JS files?” is not used.
Please ignore everything.disable the CSS file generation:
There should be no impact at all.
The styles for ALB elements that are written to the css files for each page/post are instead added right before the element in style tags in HTML DOM of the page/post.
Best regards,
GünterMarch 23, 2022 at 8:09 pm #1345756Günter,
Ok, so if we are not using file compression then the official recommendation is to just disable the CSS file generation. That accurate?
When I disable that feature it DOES resolve my issue, just wanted to make sure there was no negative impact. Thanks!March 24, 2022 at 4:03 pm #1345886Hi,
if disable the CSS files (= post specific css files) solves your problem you can do that and should be safe.
Just to give you some background:
post specific css files are created on pageload once and exist until the page/post is updated, theme options are updated or a theme version update takes place and are specific for this page/post. They are independent from the merge css or js files option settings and are located in …/uploads/avia_posts_css folder.
Merged css or js files are “static” core files that are needed for every page and only change on theme version update and are located in …/uploads/dynamic_avia.
Hope this helps you for a better understanding.
Best regards,
GünterMarch 24, 2022 at 7:27 pm #1345921Günter,
Understood, that’s the way forward then. Thanks for confirming.
March 28, 2022 at 10:08 am #1346273 -
AuthorPosts
- The topic ‘Redis Object Cache best practices’ is closed to new replies.