File Cache

The FileCache allows for efficient caching of static content. There are several configuration options that allow fine tuning of each FileCache instance:

Table 4.4. FileCache Configuration Properties

secondsMaxAgeSpecifies how long an resource may exist within the cache. If the value is zero or less, the resource may be cached indefinately. If not specified, the value defaults to -1.
maxCacheEntriesSpecified how many resources may be cached. An attempt to add an entry that causes the max number of entries to be exceeded, the resource will be removed from the cache. The default number of cached entries is 1024.
minEntrySizeThe maximum size, in bytes, a file must be in order to be cached in the heap cache. This defaults to Long.MIN_VALUE.
maxEntrySizeThe maximum size, in bytes, a resource may be before it can no longer be considered cachable. This defaults to Long.MAX_VALUE.
maxLargeFileCacheSizeThe maximum size, in bytes, of the memory mapped cache for large files. This defaults to Long.MAX_VALUE.
maxSmallFileCacheSizeThe maximum size, in bytes, a file must be in order to be cached in the heap cachevs the mapped memory cache. This defaults to 1048576.
enabledWhether or not the FileCache is enabled. This defaults to true on new NetworkListener instances.

All properties of the FileCache can be manipulated by obtaining the FileCache instance by calling NetworkListener.getFileCache().