public final class SynchronizedCachePolicy extends Object implements CachePolicy
CachePolicy
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.
|
Object |
get(Object key)
Returns the object paired with the specified key if it's
present in the cache, otherwise must return null.
|
void |
insert(Object key,
Object object)
Inserts the specified object into the cache following the
implemented policy.
|
Object |
peek(Object key)
Returns the object paired with the specified key if it's
present in the cache, otherwise must return null.
|
void |
remove(Object key)
Remove the cached object paired with the specified key.
|
int |
size() |
void |
start() |
void |
stop() |
public SynchronizedCachePolicy(CachePolicy delegate)
public Object get(Object key)
CachePolicy
CachePolicy.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 CachePolicy
key
- the key paired with the objectCachePolicy.peek(java.lang.Object)
public Object peek(Object key)
CachePolicy
CachePolicy.get(java.lang.Object)
.peek
in interface CachePolicy
key
- the key paired with the objectCachePolicy.get(java.lang.Object)
public void insert(Object key, Object object)
CachePolicy
insert
in interface CachePolicy
key
- the key paired with the objectobject
- the object to cacheCachePolicy.remove(java.lang.Object)
public void remove(Object key)
CachePolicy
remove
in interface CachePolicy
key
- the key paired with the objectCachePolicy.insert(java.lang.Object, java.lang.Object)
public void flush()
CachePolicy
flush
in interface CachePolicy
public int size()
size
in interface CachePolicy
public void create() throws Exception
create
in interface CachePolicy
Exception
public void start() throws Exception
start
in interface CachePolicy
Exception
public void stop()
stop
in interface CachePolicy
public void destroy()
destroy
in interface CachePolicy
Copyright © 2018 JBoss by Red Hat. All rights reserved.