So, a cgi program can serve a html document (like the one you are reading), or it can redirect the browser to a graphic image.
A url such as:
Will get cached by a browser and not be updated unless they hit refresh.
Will get cached some some, but not all browsers.
Will not get cached by 99% of the browsers if you update that string to reflect the time on each page. Most 'banner buster' urls use a random number. You can update that string from a cgi script if the page is dynamically generated.
You can also do if from simple java script. Drop over to search engine world and look at the source to the page for the banner busting type java script code.
When using an image type counter for this cache busting purposes, you have to have something on your server that can deal with the 'weird url'. Either have the server setup to ignore the extra stuff, or have a cgi banner server program redirect the call to the real image.
I guess after laying it out, I have to agree it is kinda involved to do yourself.