|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Cache
The main interface for the cache. Provides methods to add, access, and remove entries from a cache. <p/> Cache instances are obtained from the CacheFactory
.
Keys may be any object, although it is suggested that Strings or lightweight Serializable objects be used. In order to receive notifications to invalidate a particular key in the cache (from other nodes of a cluster or from Admin server), the key must be Serializable (so it can be transmitted between servers). Such keys must also have properly implemented equals() and hashcode() methods.
CAUTION: The cache data structure does not itself provide immutability of its values. In other words, it returns references to its actual objects. It is recommended that those values protect themselves from change unless that change is actually desired - remember these objects will eventually expire from the Cache.
Field Summary |
---|
Fields inherited from interface com.bea.p13n.cache.CacheDefaults |
---|
DEFAULT_ENABLED, DEFAULT_MAX_ENTRIES, DEFAULT_TTL, MAX_ENTRIES_MAX, TTL_NEVER_EXPIRE |
Method Summary | |
---|---|
void |
clear() Remove all elements from the cache. |
boolean |
containsKey(Object key) Determines if an entry exists in the cache. |
Set |
entrySet() Access the values of the key/value pair of the Cache. |
Object |
get(Object key) Retrieve an entry in the Cache. |
int |
getMaxEntries() Get the max number of entries the cache can have. |
String |
getName() Get cache name. |
long |
getTtl() Get the time-to-live, in milliseconds, of entries for the cache. |
boolean |
isEnabled() Is the cache enabled? |
Set |
keySet() Access the keys of the key/value pair of the Cache. |
Object |
put(Object key, Object value) Put a value into the cache. |
Object |
put(Object key, Object value, long ttl) Put a value into the cache, with a specific time-to-live. |
Object |
remove(Object key) Removes a single entry from the Cache if it exists. |
void |
setEnabled(boolean newEnabled) Set enabled mode of cache. |
void |
setMaxEntries(int maxEntries) Set the max number of items the cache can have. |
void |
setTtl(long timeToLive) Set the default time-to-live for all elements in cache. |
int |
size() Size of the cache. |
String |
toString() Describes the attributes of the cache. |
Methods inherited from interface com.bea.p13n.cache.CacheStats |
---|
getHitCount, getHitRate, getMissCount, resetStats |
Methods inherited from interface com.bea.p13n.cache.ReloadableCache |
---|
getReloader, put, put, reload, setReloader, unsetReloader |
Method Detail |
---|
Object put(Object key, Object value)
Neither the key nor the value can be null
key
- the key of the entry to createvalue
- the value to associate with the keyObject
the previous value for the keyObject put(Object key, Object value, long ttl)
Neither the key nor the value can be null
key
- the key of the entry to createvalue
- the value to associate with the keyttl
- time-to-live, in milliseconds, of the object. This ttl overrides the default ttl for the cache, and applies only to this object.Object
the previous value for the keyObject get(Object key)
key
- The key of a key/value pair to retrieve from the cache.Object
the value of the key/value pair asslciated with the key, or null if the entry does not exist or has expired.void clear()
CacheFactory.flush(String)
.Object remove(Object key)
CacheFactory.flush(String, java.io.Serializable)
.key
- The key of a key/value pair to remove from the cache.int size()
int
The number of entries in the cache.Set keySet()
Set
The set of keys in the key/value entries of the cacbe.Set entrySet()
Set
The set of values of the key/value pair of the Cache.boolean isEnabled()
boolean
, true if it is enabled, flase otherwise.void setEnabled(boolean newEnabled)
newEnabled
- true to enable the cache, false to disable the cache.boolean containsKey(Object key)
key
- The key of a key/value pair to check for existence in the cache.boolean
true if the object associated with that key exists in the cache, false otherwise.long getTtl()
void setTtl(long timeToLive)
timeToLive
- the default time to live for items in this cache , in millisecondsint getMaxEntries()
void setMaxEntries(int maxEntries)
maxEntries
- the maximum size of the cacheString getName()
String toString()
toString
in class Object
|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010, Oracle. All rights reserved.