public final class SynchronizedCachePolicy extends java.lang.Object implements CachePolicy
CachePolicy| Modifier and Type | Field and Description |
|---|---|
private CachePolicy |
delegate |
| Constructor and Description |
|---|
SynchronizedCachePolicy(CachePolicy delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
create() |
void |
destroy() |
void |
flush()
Flushes the cached objects from the cache.
|
java.lang.Object |
get(java.lang.Object key)
Returns the object paired with the specified key if it's
present in the cache, otherwise must return null.
|
void |
insert(java.lang.Object key,
java.lang.Object object)
Inserts the specified object into the cache following the
implemented policy.
|
java.lang.Object |
peek(java.lang.Object key)
Returns the object paired with the specified key if it's
present in the cache, otherwise must return null.
|
void |
remove(java.lang.Object key)
Remove the cached object paired with the specified key.
|
int |
size() |
void |
start() |
void |
stop() |
private final CachePolicy delegate
public SynchronizedCachePolicy(CachePolicy delegate)
public java.lang.Object get(java.lang.Object key)
CachePolicyCachePolicy.peek(java.lang.Object) this method not only return whether
the object is present in the cache or not, but also
applies the implemented policy that will "refresh" the cached
object in the cache, because this cached object
was really requested.get in interface CachePolicykey - the key paired with the objectCachePolicy.peek(java.lang.Object)public java.lang.Object peek(java.lang.Object key)
CachePolicyCachePolicy.get(java.lang.Object).peek in interface CachePolicykey - the key paired with the objectCachePolicy.get(java.lang.Object)public void insert(java.lang.Object key,
java.lang.Object object)
CachePolicyinsert in interface CachePolicykey - the key paired with the objectobject - the object to cacheCachePolicy.remove(java.lang.Object)public void remove(java.lang.Object key)
CachePolicyremove in interface CachePolicykey - the key paired with the objectCachePolicy.insert(java.lang.Object, java.lang.Object)public void flush()
CachePolicyflush in interface CachePolicypublic int size()
size in interface CachePolicypublic void create()
throws java.lang.Exception
create in interface CachePolicyjava.lang.Exceptionpublic void start()
throws java.lang.Exception
start in interface CachePolicyjava.lang.Exceptionpublic void stop()
stop in interface CachePolicypublic void destroy()
destroy in interface CachePolicy