public abstract class SpaceEvictionStrategy extends Object
AllInCacheSpaceEvictionStrategy
,
ConcurrentLruSpaceEvictionStrategy
Constructor and Description |
---|
SpaceEvictionStrategy() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Called when the space is closed.
|
abstract int |
evict(int numOfEntries)
Called when the space requires entries to be evicted.
|
protected SpaceEvictionStrategyConfig |
getEvictionConfig()
Returns the eviction configuration provided during initialization.
|
protected SpaceEvictionManager |
getEvictionManager()
Returns the eviction manager provided during initialization.
|
void |
initialize(SpaceEvictionManager evictionManager,
SpaceEvictionStrategyConfig config)
Called during the space initialization.
|
protected boolean |
isClosed()
Returns true if the space is closed, false otherwise.
|
void |
onInsert(EvictableServerEntry entry)
Called when a new entry is written to the space.
|
void |
onLoad(EvictableServerEntry entry)
Called when an entry is loaded into the space from an external data source.
|
void |
onRead(EvictableServerEntry entry)
Called when an entry is read from the space.
|
void |
onRemove(EvictableServerEntry entry)
Called when an entry is removed from the space.
|
void |
onUpdate(EvictableServerEntry entry)
Called when an entry is updated in the space.
|
boolean |
requiresConcurrencyProtection()
Due to the nature of the system, calls to
onRemove(EvictableServerEntry) can occur in concurrent with either
onRead(EvictableServerEntry) or onUpdate(EvictableServerEntry) or even before them. |
public void initialize(SpaceEvictionManager evictionManager, SpaceEvictionStrategyConfig config)
evictionManager
- config
- public void close()
public boolean requiresConcurrencyProtection()
onRemove(EvictableServerEntry)
can occur in concurrent with either
onRead(EvictableServerEntry)
or onUpdate(EvictableServerEntry)
or even before them.
In order to prevent this behavior this property should return true (This is the default) and the system will guard this with locks.
This should only be set to false by advanced usages which needs to be able to work under this behavior.public void onInsert(EvictableServerEntry entry)
entry
- The new entrypublic void onLoad(EvictableServerEntry entry)
entry
- The loaded entrypublic void onRead(EvictableServerEntry entry)
entry
- The read entrypublic void onUpdate(EvictableServerEntry entry)
entry
- The updated entrypublic void onRemove(EvictableServerEntry entry)
entry
- The removed entrypublic abstract int evict(int numOfEntries)
numOfEntries
- Number of entries to be evictedprotected SpaceEvictionManager getEvictionManager()
protected SpaceEvictionStrategyConfig getEvictionConfig()
protected boolean isClosed()
Copyright © GigaSpaces.