
Using MediaScript 19
•
•
•
•
File Caching
The process of reading a file over a network can be time consuming. For this reason, files
read via the FTP and HTTP protocols are stored in a local file cache. Subsequent accesses
to the same file that occur shortly after the file was last downloaded are served from the
cache rather than reread from the network.
The RefreshInterval property determines how HTTP and FTP files are cached. This
value is interpreted as a time interval in seconds and indicates how often MediaRich
should check with a HTTP or FTP server to determine if a newer version of a file exists. The
default value of this property is 900, or 15 minutes. If the value of the RefreshInterval
property is set to a negative value, then caching is disabled and every HTTP or FTP request
retrieves a file from the network.
Unless caching has been disabled, caching behavior works according to the following
sequence of events whenever a file is requested via HTTP or FTP:
MediaRich first looks to determine if the same file exists in the local cache.
•
If the file does not exist in the cache, MediaRich fetches the file.
•
If it does exist, MediaRich computes the age of that file (how long it has been since that
file was last updated).
-
If the age of the file is less than that specified using the RefreshInterval
property, MediaRich uses the cached file.
-
If the age of the file is greater than that specified using the RefreshInterval
property, MediaRich contacts the HTTP or FTP server to determine whether a newer
version of the file exists.
-
If a newer version does exist, MediaRich downloads a new copy of the file to the
cache.
-
If a newer version does not exist, the age of the file in the cache is simply reset
to 0. In all cases, the cached file is eventually returned to the caller.
This example disables file caching for FTP accesses:
filesystem.fsnet.ftp.RefreshInterval=-1
And this example refreshes interval for both HTTP and FTP accesses to five minutes:
filesystem.fsnet.RefreshInterval=300
Proxy Server Support
To route HTTP and FTP file requests through a proxy server, use the ProxyHost property.
A proxy host specification consists of a host name and port number, separated by a colon.
The following is an example that designates that FTP and HTTP requests should be routed
to port #1133 of the server named “ourproxyserver.ourcompany”:
filesystem.fsnet.ProxyHost=ourproxyserver.ourcompany:1133