public class MetadataMortalCacheEntry extends AbstractInternalCacheEntry implements MetadataAware
MetadataAware
Modifier and Type | Class and Description |
---|---|
static class |
MetadataMortalCacheEntry.Externalizer |
Modifier and Type | Field and Description |
---|---|
protected long |
created |
protected Metadata |
metadata |
internalMetadata, key, value
Modifier | Constructor and Description |
---|---|
|
MetadataMortalCacheEntry(Object key,
Object value,
Metadata metadata,
long created) |
protected |
MetadataMortalCacheEntry(Object key,
Object value,
PrivateMetadata internalMetadata,
Metadata metadata,
long created) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendFieldsToString(StringBuilder builder) |
boolean |
canExpire() |
long |
getCreated() |
long |
getExpiryTime()
Only used with entries that have a lifespan, this determines when an entry is due to expire.
|
long |
getLastUsed() |
long |
getLifespan() |
long |
getMaxIdle() |
Metadata |
getMetadata()
Get metadata of this cache entry.
|
boolean |
isExpired(long now) |
void |
reincarnate(long now)
"Reincarnates" an entry.
|
void |
setMetadata(Metadata metadata)
Set the metadata in the cache entry.
|
InternalCacheValue<?> |
toInternalCacheValue()
Creates a representation of this entry as an
InternalCacheValue . |
void |
touch(long currentTimeMillis)
Updates access timestamps on this instance to a specified time
|
clone, commit, equals, getInternalMetadata, getKey, getValue, hashCode, isChanged, isCreated, isEvicted, isL1Entry, isNull, isRemoved, setChanged, setCreated, setEvicted, setInternalMetadata, setRemoved, setSkipLookup, setValue, skipLookup, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
canExpireMaxIdle
setCreated, setLastUsed
comparingByKey, comparingByKey, comparingByValue, comparingByValue
protected Metadata metadata
protected long created
public MetadataMortalCacheEntry(Object key, Object value, Metadata metadata, long created)
protected MetadataMortalCacheEntry(Object key, Object value, PrivateMetadata internalMetadata, Metadata metadata, long created)
public final boolean isExpired(long now)
isExpired
in interface InternalCacheEntry
now
- the current time as defined by System.currentTimeMillis()
or TimeService.wallClockTime()
public final boolean canExpire()
canExpire
in interface InternalCacheEntry
public final long getCreated()
getCreated
in interface CacheEntry
public final long getLastUsed()
getLastUsed
in interface CacheEntry
public final long getLifespan()
getLifespan
in interface CacheEntry
public final long getMaxIdle()
getMaxIdle
in interface CacheEntry
public final long getExpiryTime()
InternalCacheEntry
getExpiryTime
in interface InternalCacheEntry
public final void touch(long currentTimeMillis)
InternalCacheEntry
touch
in interface InternalCacheEntry
currentTimeMillis
- the current time as defined by System.currentTimeMillis()
or TimeService.wallClockTime()
public void reincarnate(long now)
InternalCacheEntry
reincarnate
in interface InternalCacheEntry
now
- the current time as defined by System.currentTimeMillis()
or TimeService.wallClockTime()
public InternalCacheValue<?> toInternalCacheValue()
InternalCacheEntry
InternalCacheValue
. The main
purpose of this is to provide a representation that does not have a reference to the key. This is useful in
situations where the key is already known or stored elsewhere, making serialization and deserialization more
efficient.
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. This 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.
toInternalCacheValue
in interface InternalCacheEntry
public Metadata getMetadata()
MetadataAware
getMetadata
in interface MetadataAware
getMetadata
in class AbstractInternalCacheEntry
public void setMetadata(Metadata metadata)
MetadataAware
setMetadata
in interface MetadataAware
setMetadata
in class AbstractInternalCacheEntry
metadata
- to apply to the cache entryprotected void appendFieldsToString(StringBuilder builder)
appendFieldsToString
in class AbstractInternalCacheEntry
Copyright © 2021 JBoss by Red Hat. All rights reserved.