Interface BinaryEntry<K,​V>

    • Method Detail

      • getBinaryKey

        Binary getBinaryKey()
        Return a raw binary key for this entry.
        Returns:
        a raw binary key for this entry
      • getBinaryValue

        Binary getBinaryValue()
        Return a raw binary value for this entry.
        Returns:
        a raw binary value for this entry; null if the value does not exist
      • getSerializer

        Serializer getSerializer()
        Return a Serializer that is used to serialize/deserialize this entry.
        Returns:
        a Serializer that is used to serialize/deserialize this entry
      • updateBinaryValue

        void updateBinaryValue​(Binary binValue)
        Update the binary value for this entry.

        Passing a non-null binary is functionally equivalent to:

           setValue(getContext().getValueFromInternalConverter().convert(binValue));
         
        Passing null value is functionally equivalent to removing the entry.
           remove(false);
         
        Parameters:
        binValue - new binary value to be stored in this entry or null
      • updateBinaryValue

        void updateBinaryValue​(Binary binValue,
                               boolean fSynthetic)
        Update the binary value for this entry.

        Passing a non-null binary is functionally equivalent to:

           setValue(getContext().getValueFromInternalConverter().convert(binValue));
         
        Passing null value is functionally equivalent to removing the entry.
           remove(false);
         
        This method will bypass any CacheStore or BinaryEntryStore implementations, iff fSynthetic is true and the backing map associated with this entry is a ReadWriteBackingMap.
        Parameters:
        binValue - new binary value to be stored in this entry or null
        fSynthetic - pass true only if the insertion into or modification of the Map should be treated as a synthetic event
        Since:
        Coherence 12.1.2
      • getOriginalValue

        V getOriginalValue()
        Return an original value for this entry.
        Returns:
        an original value for this entry
        Since:
        Coherence 3.6
      • getOriginalBinaryValue

        Binary getOriginalBinaryValue()
        Return a raw original binary value for this entry.
        Returns:
        a raw original binary value for this entry; null if the original value did not exist
        Since:
        Coherence 3.6
      • getBackingMapContext

        BackingMapContext getBackingMapContext()
        Obtain a reference to the backing map context for the cache that this Entry corresponds to.
        Returns:
        the corresponding BackingMapContext; null if the entry does not have any backing map association
        Since:
        Coherence 3.7
      • expire

        void expire​(long cMillis)
        Update the entry with the specified expiry delay.

        Note: this method only has an effect only if the associated backing map implements the CacheMap interface

        Parameters:
        cMillis - the number of milliseconds until the entry will expire; pass CacheMap.EXPIRY_DEFAULT to use the default expiry setting; pass CacheMap.EXPIRY_NEVER to indicate that the entry should never expire
        Since:
        Coherence 3.7
      • getExpiry

        long getExpiry()
        Return the number of milliseconds remaining before the specified entry is scheduled to expire. If the expire(long) method has been called, the returned value will reflect the requested expiry delay. Otherwise if the entry exists, the returned value will represent the time remaining until the entry expires (or CacheMap.EXPIRY_NEVER if the entry will never expire). If the entry does not exist, CacheMap.EXPIRY_DEFAULT will be returned.

        This method will make a "best effort" attempt to determine the expiry time remaining. In some cases, it may not be possible to determine the expiry (e.g. the backing-map does not implement the CacheMap interface), in which case CacheMap.EXPIRY_DEFAULT will be returned.

        Returns:
        the number of milliseconds remaining before the specified entry expires
        Since:
        Coherence 12.1.3
      • isReadOnly

        boolean isReadOnly()
        Check whether this BinaryEntry allows data modification operations.
        Returns:
        true iff the entry is "read-only"
        Since:
        Coherence 3.7
      • isValueLoaded

        default boolean isValueLoaded()
        Check whether this BinaryEntry is loaded by a "read-through" operation.
        Returns:
        true iff the entry is loaded by a "read-through" operation
        Since:
        Coherence 12.2.1
      • isValueChanged

        default boolean isValueChanged()
        Check whether the value of this BinaryEntry is changed.
        Returns:
        true iff the entry is changed
        Since:
        Coherence 12.2.1.1
      • isValueUpdated

        default boolean isValueUpdated()
        Check whether the value of this BinaryEntry is updated.
        Returns:
        true iff the entry is updated
        Since:
        Coherence 12.2.1.1
      • isValueRemoved

        default boolean isValueRemoved()
        Check whether the value of this BinaryEntry is removed.
        Returns:
        true iff the entry is removed
        Since:
        Coherence 12.2.1.1
      • getAssociatedEntry

        default <K1,​V1> BinaryEntry<K1,​V1> getAssociatedEntry​(String sMapName,
                                                                          K1 key)
        Return an associated entry from the specified map, obtaining exclusive access to that map entry.

        This method may only be called within the context of an entry processor invocation. Any changes made to the entry will be persisted with the same lifecycle as those made by the enclosing invocation. The returned entry is only valid for the duration of the enclosing invocation and multiple calls to this method within the same invocation context will return the same entry object.

        Because this method implicitly locks the specified map entry, callers may use it to access, insert, update, modify, or remove map entries from within the context of an entry processor invocation. Operating on the entries returned by this method differs from operating directly against the backing map, as the returned entries provide an isolated, read-consistent view. The implicit lock acquisition attempted by this method could create a deadlock if entries are locked in conflicting orders on different threads. It is the caller's responsibility to ensure that cache entries are accessed (locked) in a deadlock-free manner.

        Type Parameters:
        K1 - the key type of the specified associated map
        V1 - the value type of the specified associated map
        Parameters:
        sMapName - the name of the associated map to return the entry from
        key - the key of the associated entry to return, in deserialized form
        Returns:
        an InvocableMap.Entry for the specified key, or null if the specified key is not owned by this service member
        Since:
        20.12
      • getAssociatedEntry

        default <K1,​V1> BinaryEntry<K1,​V1> getAssociatedEntry​(String sMapName,
                                                                          K1 key,
                                                                          boolean fReadOnly)
        Return an associated entry from the specified map, obtaining either an exclusive or shared (read-only) access to that map entry.

        This method may only be called within the context of an entry processor invocation. Any changes made to the entry obtained for exclusive access (non read-only) will be persisted with the same lifecycle as those made by the enclosing invocation. The returned entry is only valid for the duration of the enclosing invocation and multiple calls to this method within the same invocation context will return the same entry object.

        When this method locks the specified map entry for exclusive, not read-only, callers may use it to access, insert, update, modify, or remove map entries from within the context of an entry processor invocation. Operating on the entries returned by this method differs from operating directly against the backing map, as the returned entries provide an isolated, read-consistent view. The implicit lock acquisition attempted by this method could create a deadlock if entries are locked in conflicting orders on different threads. It is the caller's responsibility to ensure that cache entries are accessed (locked) in a deadlock-free manner.

        Type Parameters:
        K1 - the key type of the specified associated map
        V1 - the value type of the specified associated map
        Parameters:
        sMapName - the name of the associated map to return the entry from
        key - the key of the associated entry to return, in deserialized form
        fReadOnly - true to obtain non-exclusive, read-only access to associated entry, or false to lock associated entry for exclusive access
        Returns:
        an InvocableMap.Entry for the specified key, or null if the specified key is not owned by this service member
        Since:
        20.12
      • getKeyPartition

        default int getKeyPartition()
        Return the key partition for this BinaryEntry.
        Returns:
        the key partition for this BinaryEntry
      • getIndexMap

        default Map<ValueExtractor,​MapIndex> getIndexMap()
        Return a map of indexes defined for the partition of the cache that this BinaryEntry belongs to. The returned map must be treated in the read-only manner.
        Returns:
        the map of indexes defined for the cache partition that this BinaryEntry belongs to
        Since:
        23.03
      • setValue

        void setValue​(V value,
                      boolean fSynthetic)
        Store the value corresponding to this entry. If the entry does not exist, then the entry will be created by invoking this method, even with a null value (assuming the Map supports null values).

        Unlike the other form of setValue, this form does not return the previous value, and as a result may be significantly less expensive (in terms of cost of execution) for certain Map implementations.

        As of Coherence 12.1.2, if fSynthetic is true and the BackingMap associated with this entry is a ReadWriteBackingMap, this method will bypass the CacheStore or BinaryEntryStore.

        Specified by:
        setValue in interface InvocableMap.Entry<K,​V>
        Parameters:
        value - the new value for this Entry
        fSynthetic - pass true only if the insertion into or modification of the Map should be treated as a synthetic event
      • remove

        void remove​(boolean fSynthetic)
        Remove this Entry from the Map if it is present in the Map.

        This method supports both the operation corresponding to Map.remove(java.lang.Object) as well as synthetic operations such as eviction. If the containing Map does not differentiate between the two, then this method will always be identical to InvocableMap.this.remove(getKey()).

        As of Coherence 12.1.2, if fSynthetic is true and the BackingMap associated with this entry is a ReadWriteBackingMap, this method will bypass the CacheStore or BinaryEntryStore.

        Specified by:
        remove in interface InvocableMap.Entry<K,​V>
        Parameters:
        fSynthetic - pass true only if the removal from the Map should be treated as a synthetic event