Interface FileCache
- All Known Implementing Classes:
DefaultFileCache
,WeakRefFileCache
The interface is designed to abstract various file caching implementations so that we can use one content loading mechanism, but allow it to use different caching schemes dependent on the need of the application.
When using a cache, it is highly recommended that the URI passed in does not include the reference part (any piece after the #) as this means that you cannot cache the entire file or reference the file and extra another part of it. For example, when referring to a proto definition, you would want to store the entire file here so that any further protos in that same file do not need to be reloaded. This relies on you, the caller to make sure that the reference part is stripped from the URI string.
The implementor of this interface is free to do whatever they want with the requests - including completely ignoring it.
- Version:
- $Revision: 1.1 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Store the item in the cache.checkForFile
(String uri) Check the cache for the file nominated by this URI string.
-
Method Details
-
checkForFile
Check the cache for the file nominated by this URI string. If the file is part of the cache, a reference is returned to the details. If the item is not in the cache, it will return null.- Parameters:
uri
- The uri to check for- Returns:
- The details of the item in cache or null
-
cacheFile
Store the item in the cache. The item is stored according to whatever rules the cache uses internally for kicking out older values etc- Parameters:
uri
- The uri string for the contentcontentType
- A String describing the MIME type of the contentcontent
- The actual Java representation of the URI's content
-