Load - caches and so forth?
Dave Cragg
dcragg at lacscentre.co.uk
Fri Apr 28 11:58:38 EDT 2006
On 28 Apr 2006, at 16:04, David Bovill wrote:
> Got a couple of questions about caching with the "load" command...
>
> 1) Is the stack / file cahed in memory or on disk -- looks like
> it is in a local array in the libURL stack right?
In a libUrl array as you suspect.
>
> 2) If so the cache is lost when Rev quits - ie libURL closes?
That's right.
>
> 3) Does "load" work for all http related data access? "put" /
> "get" but also "go" in the case of stack?
All of those, but it doesn't work for movie references. I'd guess it
also doesn't work for image references either.
>
> Finally if I want a semi-permanent disk based "cache" - I guess I
> should trap something using a front script? What would be the best
> way to do this? Trap "getUrl"?, passing it if the url is not in the
> disk based cache?
I'd be wary of trapping geturl. This is a handler inside libUrl that
gets called directly by the engine, and it contains some irregular
syntax.
Why not just have your own set of handlers for getting urls. Crude
example:
function myGetUrl pUrl
if isInCache(pUrl) then
return getfromCache(pUrl)
else
get url pUrl
if the result is empty then
putInCache pUrl, it
else
## error message, etc.
end if
end myGetUrl
Sorry, no space for the isInCache, getFromCache, putInCache
handlers. :-)
Cheers
Dave
More information about the use-livecode
mailing list