Results 1 to 11 of 11

Thread: Cache Buster

  1. #1
    Join Date
    Jun 2007
    Orlando, FL

    Cache Buster

    Hi everyone,

    I apologise if this isn't in the right area of the forum, but i'm fairly new here.


    This is in regards to an advertising segment on my site. Analysisng proper impressions (i've been told) can be shot somewhat by caches. So i was referred to a cache buster, placed on an 'a href'?

    Is this right? Will adding a 'cache buster' be 'damaging' in anyway? I understand it will take longer to load than a cached part would, but I wouldn't want it on the whole site, just the advert. It's so the ad can be properly judged on impressions (cached ad's don't show up as impressions - thus giving an improper read out). Can you put it on one thing, is this ok?

    Also, if it's fine to do - to be honest i'm not really sure how to go about doing it. I can't find an example of it done in any code (or one that i've realised). Apparently you have to use a 'random number string' (not a date stamp), as it's more effective if multiple users are clicking the advert. How do you add the 'random number string' to the 'a href'. Do you simply add to the end or something (e.g. <a href = "http://www.site.com/%%randomnumberstring%%">Link</a>?) I really don't know.

    Any help or example would be greatly appreciated.

    Thanks for your help,

  2. #2
    Join Date
    Nov 2003
    Jerryville, Tejas
    More like

    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  3. #3
    Join Date
    Jun 2007
    Orlando, FL
    I was told datestamps were bad becuase they could asign the same 'random' string to multiple people if they all clicked an ad at the same time. Why this is bad, i don't know! lol. I think it would send wrong information to all but one of the multiple people?

    Lets backtrack here - i assume what you wrote was a datestamp as it says 'timestamp' somehwhere in there, but 2 be honest - i don't know. They may just look similar but refer to completley different things. If that's the case, Is what you've wrote there a 'random number string'? Or is it indeed a datestamp? If it is a datestamp, how would you put a random number string there instead of the that?

    Thanks, Rich.

  4. #4
    Join Date
    Mar 2005
    Sydney, Australia
    A date/time stamp will stop the page from caching since the same person will not request the page more than once at the same time. It doesn't matter if someone else does as that is a different computer. Unlikely that two people would click the link at the exact same millisecond in any case. A random string may duplicate itself defeating the purpose of adding it to the link.

  5. #5
    Join Date
    Jun 2007
    Orlando, FL
    That's interesting. I've seen a few mention otherwise. Personally, I have no idea so I undertook a lil' mission to find out (if cache busters were benficial to my ad's).

    Here's one of the site's i found addressing the date stamp vs. random number issue. you guys will be able to make better of if than me i'm sure;

    Cache Buster Info

    So, it's absolultley fine to do this on your ad's url's then? There's no hidden nuisances are anything? The only thing i can see myself is that obviously it'd load a bit slower than a cache of the ad because it's essentially new, but that's fine (kinda the point). Can anyone see any other potential problem's with using them?


  6. #6
    Join Date
    Nov 2003
    Jerryville, Tejas
    I didn't say date, I said timestamp. Timestamps are generated to the highest partial second resolution of the code doing the generation so unless you're getting thousands of requests per second that won't be an issue. Also, the characteristic of the value that "breaks the cache" is that it is different from the value previously submitted by the same browser. In that case even one second granularity will not matter.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  7. #7
    Join Date
    Jun 2007
    Orlando, FL
    thanks ray326.

    I wasn't sure being unfamiliar to it all whether a 'timestamp' was a 'datestamp' or not (time being similar to date) so i thought it was worth asking.

    So all you do is put that code on the end of the address and it'll generate all fine?

    Just to make clear (so i don't end up doing it wrong and annoying everyone some more!) - do you add this code (for example):


    onto the end of the 'a href' (for example):


    to make this: 'www.site.com/page.html?parm={timestamp} ' ?

    Thanks guys,

    PS: Just so i know aswell, is the above code a 'random number string', or is it something else again?
    Last edited by RTP; 06-26-2007 at 03:08 PM.

  8. #8
    Join Date
    Nov 2003
    Jerryville, Tejas
    It's random enough. Obviously (to me at least but maybe to no one else) the string "{timestamp}" represents the output of a bit of code that depends on the server side technology (ASP, PHP, Java, ...).
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  9. #9
    Join Date
    Jun 2007
    You could do this in several ways. For example, in PHP, you'd use something like this:
    PHP Code:
    <a href="http://www.example.com/ad.html?parm=<?=time()?>">Link</a>
    You could also, maybe, do this in Javascript (I don't know much JS, but here's my attempt).

    HTML Code:
    <div id="thead"><a href="http://www.example.com/ad.html">Link</a></div>
    <script language="javascript">
    document.getEementById("thead").innerHTML = 'a href="http://www.example.com/ad.html?parm=' + getTime() + '">Link</a>';
    I'm sure that's a horrible way to do it, but it'd work, and it has the advantage of not requiring you to use PHP.

    Who's your webhost? PHP would be the best way to do this, if you can.

    And no, a timestamp isn't a random number. It's actually (in PHP) the number of seconds since 1970. Still, it doesn't need to be a random number. It just needs to change each time the link is clicked on.
    Last edited by bluestars; 06-27-2007 at 07:00 PM.

  10. #10
    Join Date
    Jun 2007
    Orlando, FL

    Thanks for the info there bluestars.

    Atm, i'm just developing the site, or rather, testing things that i've kinda 'storyboarded' to see if parts I've designed are actually feasable when it comes to actually making the code of the site (if that makes sense!). In other words, just in the preliminary stage of coding tests (well, tests for me as everything is fairly new!).

    I was told cache busting can obtimize ad analysis, so i thought it'd be worth implimenting.

    I'm using Dreamweaver 8 to put my site together (have Adobe Go Live but am much more familiar with Dreamweaver). So, as i'm completley unversed in PHP - does the PHP version code simply go in the 'coding' of the site in Dreamweaver, or do you have to do it someplace else/some other way? Would you have to have already got all the hosting and the like worked out b4 using this PHP, as my site like i said is still in test phase, not uploaded yet or anything (I have a domain name but no hosting secured as of yet).

    This may sound all so stupid, i'm not sure, but I'm fairly new to all this; and in truth have only heard of PHP - i have no real idea of what it does!

    Thanks guys for you patience and help.

  11. #11
    Join Date
    Jun 2007
    PHP is a server-side language. That means that the client won't ever see your code; they'll just see the output. If you find a host that supports PHP, you'd just have to name your page with a .php extension (so the server runs the PHP program on it) and then put the code in as you would normal html.

    But, testing it on your computer, the php will never get executed. So, if you get a webhost who supports it, just put that php in where ever you'd put HTML.

    Actually, use this. For some reason the shorthand hasn't been working for me lately.
    PHP Code:
    <?php echo time(); ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.17600 seconds
  • Memory Usage 2,959KB
  • Queries Executed 13 (?)
More Information
Template Usage (34):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_html
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (11)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (11)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates