Solved

CFHTTP and web caching...  will this work?

Posted on 2003-11-05
5
330 Views
Last Modified: 2013-12-24
Instead using an FTP transfer to get an XML file off a remote web server I thought about using CFHTTP to get it.  I was then told, it may not be good because the my internet connection is running through caching servers.

Then I started to think, what if I added a random number in a URL parameter in my CFHTTP :

<cfhttp url="http://www.website.com/file.xml?noCache=#RandRange(1,999)##RandRange(1,999)##RandRange(1,999)#" method="get"...>

Will this defeat any caching issues?
0
Comment
Question by:orangachang
5 Comments
 
LVL 6

Expert Comment

by:PE_CF_DEV
ID: 9689296
I don't want to say I am 100% sure that would work but it should. Its the same idea as we do to get around caching servers;  we append a page request id to all the URL's. From what I can tell it has worked.
0
 
LVL 6

Expert Comment

by:PE_CF_DEV
ID: 9689329
additionally unless you are doing it more often than 1 second why not just use now() instead of random numbers.

<cfhttp url="http://www.website.com/file.xml?noCache=#urlencodedformat(now())#" method="get"...>
0
 
LVL 4

Accepted Solution

by:
procept earned 100 total points
ID: 9693124
P_CF_DEV is right, but, instead of using now() or a random number, I would suggest using getTickCount()... it's unique for every millisecond...

<cfhttp url="http://www.website.com/file.xml?noCache=#getTickCount()#" method="get"...>

HTH,

Chris


0
 
LVL 2

Expert Comment

by:jonnygo55
ID: 9695522
all these will probably work for you or:
...noCache=#CreateUUID()#...
0
 
LVL 10

Expert Comment

by:substand
ID: 9699376
should work
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question