Interface InternalCacheValue<V>

  • All Known Implementing Classes:
    ImmortalCacheValue, MetadataImmortalCacheValue, MetadataMortalCacheValue, MetadataTransientCacheValue, MetadataTransientMortalCacheValue, MortalCacheValue, TransientCacheValue, TransientMortalCacheValue

    public interface InternalCacheValue<V>
    A representation of an InternalCacheEntry that does not have a reference to the key. This should be used if the key is either not needed or available elsewhere as it is more efficient to marshall and unmarshall. Probably most useful in cache stores.

    Note that this should not be used to optimize memory overhead, since the saving of an additional reference to a key (a single object reference) does not warrant the cost of constructing an InternalCacheValue, where an existing InternalCacheEntry is already referenced.

    Use of this interface only makes sense when marshalling is involved, since the cost of marshalling the key again can be sidestepped using an InternalCacheValue if the key is already known/marshalled.

    Since:
    4.0
    Author:
    Manik Surtani
    • Method Detail

      • getValue

        V getValue()
        Returns:
        the value represented by this internal wrapper
      • isExpired

        boolean isExpired​(long now)
        Parameters:
        now - the current time as expressed by System.currentTimeMillis()
        Returns:
        true if the entry has expired; false otherwise
      • isExpired

        @Deprecated
        boolean isExpired()
        Deprecated.
        Returns:
        true if the entry has expired; false otherwise
      • canExpire

        boolean canExpire()
        Returns:
        true if the entry can expire, false otherwise
      • getCreated

        long getCreated()
        Returns:
        timestamp when the entry was created
      • getLastUsed

        long getLastUsed()
        Returns:
        timestamp when the entry was last used
      • getLifespan

        long getLifespan()
        Returns:
        lifespan of the value
      • getMaxIdle

        long getMaxIdle()
        Returns:
        max idle time allowed
      • getExpiryTime

        long getExpiryTime()