Package org.geotools.util
Class ObjectCaches
Object
ObjectCaches
This is facade around several constructs used by GeoTools for internal caching.
This class provides the following services:
- Access to an implementation of "weak", "all" and "none" implementations of
ObjectCache
. - The ability to turn a "code" into a good "key" for use with an ObjectCache.
- A Pair data object (think of C STRUCT) for use as a key when storing a value against two objects.
- Since:
- 2.5
- Author:
- Jody Garnett, Cory Horner
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> ObjectCache<K, V> chain
(ObjectCache<K, V> level1, ObjectCache<K, V> level2) Create a two level cache, operates as a level1 cache that is willing to obtain values from a (usually shared) level2 cache.static <K,
V> ObjectCache<K, V> Utility method used to produce an ObjectCache.static <K,
V> ObjectCache<K, V> Utility method used to produce cache based on provide Hintstatic String
Produce a good key based on the privided citaiton and code.static Object
Produce a good key based on a pair of codes.
-
Method Details
-
chain
Create a two level cache, operates as a level1 cache that is willing to obtain values from a (usually shared) level2 cache.This functionality is used to tie two ObjectCache implementations together (allowing them to collaborate while focusing on different use cases). The real world example of chaining is in
AbstractFindableAuthorityFactory
in which:- create uses: chain( cache, findCache )
- find uses: chain( findCache, cache )
- Returns:
- ObjectCache
-
create
Utility method used to produce cache based on provide Hint- Throws:
FactoryRegistryException
-
create
Utility method used to produce an ObjectCache.- Parameters:
policy
- One of "weak", "all", "none", "soft"size
- Used to indicate requested size, exact use depends on policy- Returns:
- A new ObjectCache
- See Also:
-
Hints.BUFFER_POLICY
-
toKey
Produce a good key based on the privided citaiton and code. You can think of the citation as being "here" and the code being the "what".- Parameters:
code
- Code- Returns:
- A good key for use with ObjectCache
-
toKey
Produce a good key based on a pair of codes.- Returns:
- A object to use as a key
-