URL caching mystery.

Alex Tweedly alex at tweedly.net
Mon Feb 27 20:55:21 EST 2006


I'm trying to understand (or at least deal with) caching of URLs

The basics seem to work as I expected (i.e. as I interpret the docs).
First,
 put "http://127.0.0.1/file1.mp3" into blah

Then

load URL blah               puts the url into the cache
put URL blah into t        will take from the cache if it's there, 
otherwise fetch from server.
                                     if it needs to be fetched, it is 
not added to the cache
unload URL blah          removes it from the cache

BUT
set the filename of player "Player" to blah
fetches the file from the server, caches it locally and then sets the 
filename property.
I know it caches the data, because if I repeat that code again soon 
afterwards, there is no request sent to the server.

However - the two cache sets seem to be completely independent. Even if 
I do
load URL blah
   first, then
set the filename of player "Player" to blah
   the second command still sends a request, it doesn't use the copy 
cached by "load URL".

btw - the docs do say

>  To pre-fetch a file from the Internet in order to speed up access to 
> it, use the load command before visiting the card that holds the 
> player or image that references the file's URL.

but that does not match what I see - a request for the file is sent 
again when I "set the filename of player ..."

(This is a pain to test, because you only get one try for each file and 
the it is held in the second cache ...)

Similarly, setting the filename of the player doesn't make the entry 
appear in "the cachedURLs" - and there doesn't appear to be any way to 
find out which URLs have been cached by the "set filename" commands.

Is there any way to join the two caching mechanisms ?
Or to find out what is being cached by the "set filename of player" scheme ?
   (and if necessary to clear that cache) ?


-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/270 - Release Date: 27/02/2006




More information about the Use-livecode mailing list