Home > php > Test if fragment caching is working

Test if fragment caching is working

December 19Hits:39

I had this fragment caching function added in the `function.php. it goes like this:

    function fragment_cache($key, $ttl, $function) {           if ( is_user_logged_in() ) {             call_user_func($function);             return;           }           $key = apply_filters('fragment_cache_prefix','fragment_cache_').$key;           $output = get_transient($key);           if ( empty($output) ) {             ob_start();             call_user_func($function);             $output = ob_get_clean();             set_transient($key, $output, $ttl);           }           echo $output;         }   

I'd called the function on my php files. How can i possibly test if the fragment cache is working?

Related Articles

  • The effect of using Rails fragment cachingAugust 21

    Rails provides a few caching techniques, one of which is a fragment cache. The fragment cache is a dead-easy way to cache bits of your view. After checking that your queries are doing sensible things, the next often slowest part of the Rails stack is

  • AJAX vs Fragment Caching for W3 Total Cache April 13

    I'm running a WP site with WooCommerce and I want to do some caching. I'm going to exclude the pages such as the cart/checkout for obvious reasons however there are a couple of the things on the site I would like to stay dynamic and not be cached. An

  • Exclude certain block from caching using Fragment Caching - doesn't work May 10

    I have a one form, and I'm inserting it on page footer from a function file. I need to display a random form to each visitors and thus have a function developed to support this. However, with caching enabled the randomness doesn't work. I'm using W3

  • Fragment caching increasing database queriesFebruary 4

    While implementing fragment caching on a wordpress site by using the technique described here: http://css-tricks.com/wordpress-fragment-caching-revisited/ I found that it seems to actually increase queries. I have now cached many fragments on the pag

  • How can I use fragment caching to exclude certain plugins from being cached?April 27

    I'm using the popular W3TC to optimize load times. The website that I run is dynamic and has login widgets as well as status indicators for game servers. The widgets are not hard-coded into the template file, so I don't see how I could do this manual

  • Difference between fragment caching and wp_cacheJuly 17

    I've been really confused about this two caching. What's the main difference of fragment caching vs wp_cache? Can both of them be used hand in hand? EDIT i've read about the fragment caching found in the link commented by Mr. Steven. I just want to k

  • Test if fragment caching is workingDecember 19

    I had this fragment caching function added in the `function.php. it goes like this: function fragment_cache($key, $ttl, $function) { if ( is_user_logged_in() ) { call_user_func($function); return; } $key = apply_filters('fragment_cache_prefix','fragm

  • Rails 4 Fragment Cache Entire Page. How to Expire Cache In ModelFebruary 12

    How do I expire the main-page fragment in a model? In my HTML <% cache 'main-page' do %> # html here <% end %> In my Post Model after_create :clear_cache after_update :clear_cache def clear_cache ActionController::Base.new.expire_fragment('mai

  • fragment caching woocommerceFebruary 7

    Im using woocommerce with wp-rocket(cache). Question: Prevent caching of breadcrumbs, when wp-rocket cache is on ? Dynamic breadcrumbs Why: If you have a product in categorie X, Y and Z for instance, and you navigate to the product from within the ca

  • How do you cache web pages with a personalized header using caching reverse proxy such as Squid, Varnish, or NginxApril 8

    Pretty much every page of my website is dynamically generated. However they don't change that frequently (kinda similar to a forum page). So I'd like to cache them using a caching reverse proxy such as Squid, varnish or Nginx. The problem is that for

  • What type of websites shouldn't use a cache?July 18

    Is there ever a time when you should use caching? Like for frequently updated pages? Or, should you always cache? Please give examples and reason? --------------Solutions------------- Guess it depends on what you mean by cache. Database query caching

  • WP-e-Commerce and W3-Total-Cache integration problem December 3

    My shopping cart is being cached by w3 total cache. This is the expected default behaviour. The thing is I can't find an easy solution for this. I am showing my shopping cart on almost every page, so using rejected cookies or something similar is not

  • W3 total cache - cache refresh programmatically January 17

    I am building a Digg like website in WordPress. After installing W3 Total Cache, I noticed certain elements such as number of votes (and voters ids) per post are cached even though they shouldn't be (at least not after a user votes for an article). I

  • How do I get W3 Total Cache not to cache sidebars? February 28

    At the moment I run PHP code in my side bars. Even though I have the following header("Pragma: no-cache"); header("cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // D

  • Can I ignore caching of a plugin in W3 Total Cache? March 26

    I currently have a plugin that lets me display a random post in a widget. The problem is that if I activate w3 total cache it will only display that post as long as the cache hasn't been cleared. Is there a way to cache everything except this plugin?

  • Stylesheet switching and cachingJuly 6

    I'm implementing a site that allows users to switch stylesheets (to show a high contrast version for people with vision impairments). The switcher essentially just changes the <link>ref to whichever stylesheet is appropriate. However, I've just real

  • Headway body classes and W3TC page cache conflict January 9

    I'm currently working on a website using WordPress, Headway, Modernizr and W3 Total Cache. The problem I'm having is that W3TC is caching the body tag, which means that this isn't being updated depending on the users browser by Modernizr. An example

  • How to exclude a specific template from being cached by a CDN April 14

    I'm using a specific template on my self-hosted WordPress blog to display a page with randomized posts. Recently, I configured W3 Total Cache to make use of a content delivery network (CDN). When not logged in as the administrator, a user will have s

  • Will caching WordPress affect session variables, custom filed updates and displaying images from a non wordpress table?August 7

    I have a hybrid between a WordPress installation and another database with products data. I have custom php codes which pull product data from the external database. I want to cache everything that's WordPress but let the custom php codes function no

  • Disable WordPress cache programmatically on a request October 4

    How do I turn off the WP Super Cache & W3 Total Cache functionality programmatically? For instance, I neither want to make it use the cache on some requests nor cache the output of the request, do they support that using filters? I couldn't find anyt

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 15 q. 0.428 s.