Interface IDataCacheGroup


  • public interface IDataCacheGroup
    A group for data caches entries to sort similar entries in one place. This eases the manipulation of logical groups of data cache entries.

    A lifetime or a daily invalidation time can be set for each data cache entry. When the lifetime or the daily invalidation time is reached, then the entry is invalidated (i.e. deleted). Note that the invalidation is it is not guaranteed to be made precisely at the chosen moment as this is done by a low-priority background job

    Note, that entries may be deleted when the available free memory is critical

    Since:
    14.08.2008
    API:
    This is a public API.
    • Method Detail

      • getEntry

        IDataCacheEntry getEntry​(String identifier)
        Returns the entry with the given identifier. It is guaranteed that invalidated entries are not returned.
        Parameters:
        identifier - the ID of the entry to return, must not be null
        Returns:
        the entry with the given identifier or null when not found
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getEntries

        List<IDataCacheEntry> getEntries()
        Returns an unsorted list with all cache entries of this cache group
        Returns:
        the list with all entries. an empty list when no entries exist
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • invalidateEntry

        void invalidateEntry​(IDataCacheEntry entry)
        Invalidates the given cache entry. When the entry is not part in this group or is already invalid the operation does nothing
        Parameters:
        entry - the cache entry to invalidate, must not be null
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • invalidateEntry

        void invalidateEntry​(String identifier)
        Invalidates the cache entry with the given identifier if it is in this group
        Parameters:
        identifier - the identifier of the cache entry to invalidate, must not be null
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • getIdentifier

        String getIdentifier()
        Returns the identifier of this cache group. The identifier for the group and must be unique within the cache scope.
        Returns:
        the group name of this cache
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • size

        int size()
        Returns the number of cache entries in this data cache group
        Returns:
        the number of cache entries in this data cache group
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getLifetime

        int getLifetime()
        Returns the full lifetime of this cache group in seconds. To compute the point in time when the group will get invalid, do the following new Date(getLoadDate().getTime() + lifetime)
        Returns:
        the lifetime in seconds; -1 for infinite lifetime
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • setLifetime

        void setLifetime​(int lifetime)
        Sets the lifetime of this cache group. If set, the group is invalidated when the lifetime elapses after the creation of the entry. Setting the value of the group after its creation re-starts this countdown for invalidation.

        Note that the invalidation is performed asynchronously by a background job (see the system property DataCache.InvalidationJob.Interval for the interval of execution) and therefore the invalidation does not take place precisely after end of the lifetime but just during the first execution of that job thereafter

        Parameters:
        lifetime - the lifetime to set in seconds; -1 for infinite lifetime
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • setInvalidationTime

        void setInvalidationTime​(String time)
        Sets the invalidation time of this cache group. If set, the group is invalidated once daily at that time.

        Note that the invalidation is executed asynchronously by a background job (see the system property DataCache.InvalidationJob.Interval for the interval of execution) and therefore the invalidation does not take place precisely at the invalidation time but just during the first execution of that job after the invalidation time

        Parameters:
        time - the time to set in hh:mm format; null to unset
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • getInvalidationTime

        String getInvalidationTime()
        Returns the daily invalidation time of this cache group.
        Returns:
        the lifetime in seconds; null for no invalidation time
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • getLoadDate

        Date getLoadDate()
        Returns the load date of this data cache group. The load date is the date and time when the group was created. If a lifetime is set, then the group is invalidated after load date + lifetime.
        Returns:
        the load date of this cache group
        See Also:
        getLifetime()
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.