Interface IDataCache
A Data Cache is a container for data cache groups and therefore as well for data cache entries.
A cache is always bound to either a Session
or an
Application
, is related to its host lifecycle and
manages all cache entries for their given scope.
A cache can be categorized by the API client in several groups to deal with similar entries in one go.
- Since:
- 14.08.2008
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionReturns a list with all entries of all groupsgetEntries
(IDataCacheGroup group) Returns a list of all cache entries of the given groupgetEntries
(String groupIdentifier) Returns a list of all cache entries of the given groupReturns the cache entry corresponding to the given group name and identifierReturns the group with the given nameReturns all cache groupsvoid
Invalidates all groups including all their entries within this cachevoid
invalidateEntry
(IDataCacheGroup group, IDataCacheEntry entry) Invalidates the data cache entry with .void
invalidateGroup
(IDataCacheGroup group) Invalidates the group with the given name and all the cache entries within this cache groupstatic IDataCache
of
(IApplication app) static IDataCache
If not already existing, creates a new cache entry with the given identifier, lifetime and value.If not already existing, creates a new cache entry with the given identifier and value.
-
Method Details
-
of
- Parameters:
app
- the application- Returns:
- the data cache that is associated with the given application.
- API:
- This public API is available in Java.
-
of
- Parameters:
session
- of a user- Returns:
- the data cache that is associated with given session.
- API:
- This public API is available in Java.
-
getEntry
Returns the cache entry corresponding to the given group name and identifier- Parameters:
groupIdentifier
- the name of the group the requested entry is part ofidentifier
- the identifier of the requested entry- Returns:
- the requested cache entry or null when not found
- API:
- This public API is available in Java.
-
setEntry
If not already existing, creates a new cache entry with the given identifier and value. The entry is then added to the given cache group (which itself is created when it does not exist already)
If a cache entry with the given group/id exists already, it's value will be replaced.
The lifetime is set to infinite (-1).
- Parameters:
groupIdentifier
- the name of the group the cache entry should belong to, must not be nullidentifier
- the identifier of this cache, must not be nullvalue
- the data to be cached- Returns:
- the created or changed entry
- API:
- This public API is available in Java.
-
setEntry
If not already existing, creates a new cache entry with the given identifier, lifetime and value. The entry is then added to the given cache group (which itself is created when it does not exist already)
If a cache entry with the given group/id exists already, it's value will be replaced.
- Parameters:
groupIdentifier
- the identifier of the group the cache entry should belong to, must not be nullidentifier
- the identifier of this cache entry, must not be nulllifetime
- the lifetime of the cache entry in seconds; -1 for infinite lifetimevalue
- the data to be cached- Returns:
- the created or changed entry
- API:
- This public API is available in Java.
-
getEntries
List<IDataCacheEntry> getEntries()Returns a list with all entries of all groups- Returns:
- the complete list of cache entries; null if no entries exist
- API:
- This public API is available in Java.
-
getEntries
Returns a list of all cache entries of the given group- Parameters:
groupIdentifier
- the name of the group- Returns:
- the complete list of cache entries in the given group; null if no entries exist
- API:
- This public API is available in Java.
-
getEntries
Returns a list of all cache entries of the given group- Parameters:
group
- the group- Returns:
- the complete list of cache entries in the given group; null if no entries exist
- API:
- This public API is available in Java.
-
getGroups
List<IDataCacheGroup> getGroups()Returns all cache groups- Returns:
- the complete list of cache groups; an empty list when the group with the given name does not exist
- API:
- This public API is available in Java.
-
getGroup
Returns the group with the given name- Parameters:
groupname
- the name of the group- Returns:
- the group or null if no group with the name exists
- API:
- This public API is available in Java.
-
invalidate
void invalidate()Invalidates all groups including all their entries within this cache- API:
- This public API is available in Java.
-
invalidateGroup
Invalidates the group with the given name and all the cache entries within this cache group- Parameters:
group
- the group to invalidate- API:
- This public API is available in Java.
-
invalidateEntry
Invalidates the data cache entry with . This is a convenience method forgetEntry(String, String)
combined withIDataCacheEntry.invalidate()
.- Parameters:
group
- the data cache group of the entry to invalidateentry
- the data cache entry to invalidate- API:
- This public API is available in Java.
-