{"id":321,"date":"2022-05-06T00:05:46","date_gmt":"2022-05-05T18:35:46","guid":{"rendered":"http:\/\/blog.wpoven.com\/?p=321"},"modified":"2022-05-06T00:05:46","modified_gmt":"2022-05-05T18:35:46","slug":"wpbase-cache-plugin-features-and-advantages","status":"publish","type":"post","link":"https:\/\/www.wpoven.com\/blog\/wpbase-cache-plugin-features-and-advantages\/","title":{"rendered":"WPBase-cache plugin features and advantages"},"content":{"rendered":"<p>Currently a lot of useful caching plugins are available for wordpress. Most popular and successful among them are W3 Total Cache and Super Cache and Batcache. All of these plugins help improve speed of website and reduce page load time. This post is to make you aware of the features and problems of caching plugins.<\/p>\n<p>How caching plugins works &#8211;<\/p>\n<ul>\n<li>A request comes for a page with several request parameters including URL, cookies, referer, form input<\/li>\n<li>WordPress generates a response page after parsing all the request parameters<\/li>\n<li>Main page specific content depends upon URL but other things on the page may depend upon different request parameter<\/li>\n<li>Caching plugin stores this response when the request to the URL comes<\/li>\n<li>Another requests come for same page and caching plugin intercepts it before wordpress start generation of response<\/li>\n<li>Caching plugin then checks if it has the response for URL in cache and sends that cached copy directly<!--more--><\/li>\n<\/ul>\n<p>Notice that caching plugins store generated pages according to the URL only, they ignore all other request parameters. This is why most of the caching plugins create problems when there are features which depend upon request parameters other than URL. We also faced same problem while developing a video site. Video view count and ratings were not working properly, as plugins which were providing these features were not being executed because of the caching plugin. After trying to modify already available plugins with no success we decided to develop our own caching plugin <a href=\"http:\/\/wordpress.org\/plugins\/wpbase-cache\/\" target=\"_blank\" rel=\"noopener noreferrer\">wpbase-cache<\/a>, which has specific options to solve these problems.<\/p>\n<p>WPBase-cache is specifically developed for varnish and nginx server stack. The plugin itself does not cache full pages, it caches database queries using <a href=\"http:\/\/wordpress.org\/plugins\/db-cache-reloaded-fix\/\" target=\"_blank\" rel=\"noopener noreferrer\">db-cache-reloaded-fix<\/a> plugin which is integrated in wpbase-cache after some modification. Full page caching is done by varnish and our plugin controls behavior of varnish cache by different methods. Our plugin invalidates varnish cache of a page whenever there is some changes in page content or comments section. For solving the view count problem there is a option which takes view count meta_key which is used to store views of a post\u00a0 in postmeta database table. We also included a specific setting option to take care of ratings and similar problems have a look at example below to understand this.<\/p>\n<p>We tested this plugin for a site using video plus theme by themejunkies and wp-postratings plugin. To find meta_key for view count go to any post page and view its custom-fields where you can find a field name related to &#8220;view&#8221; word, like shown in screenshot below &#8211;<\/p>\n<p><a href=\"https:\/\/www.wpoven.com\/blog\/wp-content\/uploads\/2013\/08\/viewcount.jpg\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-327\" src=\"https:\/\/www.wpoven.com\/blog\/wp-content\/uploads\/2013\/08\/viewcount-300x127.jpg\" alt=\"viewcount\" title=\"\"><\/a><\/p>\n<p>For other setting which solves rating problem open firebug console (or any other browser debugging tool you use), go to network tab and click on rating button. After clicking a xhr request will appear in network tab of debugging tolls console. Not value of &#8220;action&#8221; parameter and name of another parameter with value as post id. In example below value of action is &#8220;postratings&#8221; and name of other parameter is &#8220;pid&#8221; &#8211;<\/p>\n<p><a href=\"https:\/\/www.wpoven.com\/blog\/wp-content\/uploads\/2013\/08\/postrating.jpg\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-328\" src=\"https:\/\/www.wpoven.com\/blog\/wp-content\/uploads\/2013\/08\/postrating-300x97.jpg\" alt=\"postrating\" title=\"\"><\/a><\/p>\n<p>Once you have figured out these values final settings of <a href=\"http:\/\/wordpress.org\/plugins\/wpbase-cache\/\" target=\"_blank\" rel=\"noopener noreferrer\">wpbase-cache<\/a> look like this &#8211;<\/p>\n<p><a href=\"https:\/\/www.wpoven.com\/blog\/wp-content\/uploads\/2013\/08\/Screenshot-from-2013-08-03-123416.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-331\" src=\"https:\/\/www.wpoven.com\/blog\/wp-content\/uploads\/2013\/08\/Screenshot-from-2013-08-03-123416-300x163.png\" alt=\"wpbase-cache settings\" title=\"\"><\/a><\/p>\n<p>To know more about these settings download and install <a href=\"http:\/\/wordpress.org\/plugins\/wpbase-cache\/\" target=\"_blank\" rel=\"noopener noreferrer\">wpbase-cache<\/a> plugin. We have been working on this plugin to improve it and to provide other settings which can handle other major problems caused by caching pages.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Currently a lot of useful caching plugins are available for wordpress. Most popular and successful among them are W3 Total Cache and Super Cache and Batcache. All of these plugins help improve speed of website and reduce page load time. This post is to make you aware of the features and problems of caching plugins.<br \/>\nHow caching plugins works &#8211;<\/p>\n<p>A request comes for a page with several request parameters including URL, cookies, referer, form input<br \/>\nWordPress generates a response page after parsing all the request parameters<br \/>\nMain page specific content depends upon URL but other things on the page may depend upon different request parameter<br \/>\nCaching plugin stores this response when the request to the URL comes<br \/>\nAnother requests come for same page and caching plugin intercepts it before wordpress start generation of response<br \/>\nCaching plugin then checks if it has the response for URL in cache and sends that cached copy directly &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.wpoven.com\/blog\/wpbase-cache-plugin-features-and-advantages\/\" class=\"more-link\">Read More <i class=\"fa fa-angle-double-right\" aria-hidden=\"true\"><\/i><span class=\"screen-reader-text\"> &#8220;WPBase-cache plugin features and advantages&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ub_ctt_via":"","footnotes":""},"categories":[9],"acf":[],"featured_image_src":null,"author_info":{"display_name":"Vikrant Datta","author_link":"https:\/\/www.wpoven.com\/blog\/author\/vikrant\/"},"_links":{"self":[{"href":"https:\/\/www.wpoven.com\/blog\/wp-json\/wp\/v2\/posts\/321"}],"collection":[{"href":"https:\/\/www.wpoven.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wpoven.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wpoven.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wpoven.com\/blog\/wp-json\/wp\/v2\/comments?post=321"}],"version-history":[{"count":2,"href":"https:\/\/www.wpoven.com\/blog\/wp-json\/wp\/v2\/posts\/321\/revisions"}],"predecessor-version":[{"id":12422,"href":"https:\/\/www.wpoven.com\/blog\/wp-json\/wp\/v2\/posts\/321\/revisions\/12422"}],"wp:attachment":[{"href":"https:\/\/www.wpoven.com\/blog\/wp-json\/wp\/v2\/media?parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wpoven.com\/blog\/wp-json\/wp\/v2\/categories?post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}