|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.spicefactory.lib.reflect.util.Cache<K,V>
public class Cache<K,V>
Cache implementation optimized for concurrent access to objects which are expensive to create.
It uses a Factory which can be specified by applications to create new objects whenever there is a request for a key for which no instance has been created yet.
This implementation is based on the principles outlined in the chapter "Building an efficient, scalable result cache" from the book "Java Concurrency in Practice" by Brian Goetz.
| Nested Class Summary | |
|---|---|
static interface |
Cache.Factory<K,V>
A Factory is used by cache instances to create objects whenever there is a request for a key for which no instance has been created yet. |
| Constructor Summary | |
|---|---|
Cache(Cache.Factory<K,V> factory)
Creates a new Cache instance. |
|
| Method Summary | |
|---|---|
V |
get(K key)
Returns the object for the specified key. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Cache(Cache.Factory<K,V> factory)
factory - the factory to use for creating new instances| Method Detail |
|---|
public V get(K key)
key - the key to return the corresponding instance for
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||