Interface IDataCache


  • public 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 Detail

      • getEntry

        IDataCacheEntry getEntry​(String groupIdentifier,
                                 String identifier)
        Returns the cache entry corresponding to the given group name and identifier
        Parameters:
        groupIdentifier - the name of the group the requested entry is part of
        identifier - the identifier of the requested entry
        Returns:
        the requested cache entry or null when not found
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • setEntry

        IDataCacheEntry setEntry​(String groupIdentifier,
                                 String identifier,
                                 Object value)

        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 null
        identifier - the identifier of this cache, must not be null
        value - the data to be cached
        Returns:
        the created or changed entry
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • setEntry

        IDataCacheEntry setEntry​(String groupIdentifier,
                                 String identifier,
                                 int lifetime,
                                 Object value)

        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 null
        identifier - the identifier of this cache entry, must not be null
        lifetime - the lifetime of the cache entry in seconds; -1 for infinite lifetime
        value - the data to be cached
        Returns:
        the created or changed entry
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • 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 IvyScript and Java. It has the visibility NOVICE.
      • getEntries

        List<IDataCacheEntry> getEntries​(String groupIdentifier)
        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 IvyScript and Java. It has the visibility NOVICE.
      • getEntries

        List<IDataCacheEntry> getEntries​(IDataCacheGroup group)
        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 IvyScript and Java. It has the visibility NOVICE.
      • 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 IvyScript and Java. It has the visibility NOVICE.
      • getGroup

        IDataCacheGroup getGroup​(String groupname)
        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 IvyScript and Java. It has the visibility NOVICE.
      • invalidate

        void invalidate()
        Invalidates all groups including all their entries within this cache
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • invalidateGroup

        void invalidateGroup​(IDataCacheGroup group)
        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 IvyScript and Java. It has the visibility EXPERT.
      • invalidateEntry

        void invalidateEntry​(IDataCacheGroup group,
                             IDataCacheEntry entry)
        Invalidates the data cache entry with . This is a convenience method for getEntry(String, String) combined with IDataCacheEntry.invalidate().
        Parameters:
        group - the data cache group of the entry to invalidate
        entry - the data cache entry to invalidate
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.