WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] Prevent plugin data from getting cached ? (3 posts)

  1. kettlewell
    Member
    Posted 1 year ago #

    I'm creating a homebrew ad manager plugin for multisite that has a weighted random ad serving routine... I'm afraid that it's going to get cached, and kill the randomness...

    Are there any special things that I can design into the plugin that will prevent that aspect from getting cached?

    I'm currently using a CDN (CloudFront) with object, page and DB caching going to disk on a tmpfs fileshare...

    Any advice would be warmly welcomed.

    Thanks

    Matt

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. bheadrick
    Member
    Posted 1 year ago #

    What you're looking for is fragment caching - you just have to surround the code you want to not be cached with mfunc or mclude tags. Alternatively, you could use javascript or iframes.

    If you use fragment caching, though, you can't use Enhanced caching. Since you're using DB Caching, I assume you're on a VPS or dedicated server, so other page caching options might be available for you, and I'm not sure whether they will work with these dynamic tags or not. You can always try them. If they don't work, what will happen is the whole page will just not get cached, so your best bet is to try it out. Basic caching might give you enough benefit, anyway.

    Edit your templates to with the following syntax to ensure that dynamic features remain so:

    Example 1:
    <!-- mfunc any PHP code --><!-- /mfunc -->
    Example 2:
    <!-- mfunc -->any PHP code<!-- /mfunc -->
    Example 3:
    <!--MFUNC -->
    echo rand();
    <!--/mfunc -->
    Example 4:
    <!-- mclude path/to/file.php --><!-- /mclude -->
    Example 5:
    <!-- mclude -->path/to/file.php<!-- /mclude -->

  3. kettlewell
    Member
    Posted 1 year ago #

    Excellent -

    This is what I was looking for...I knew I'd seen it some where before but was at a loss.

    Thanks so much - looks like it's installed and working :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.