public final class CacheOptions extends Object
CacheOptions should be assigned to the Usecase of the UnitOfWork, to give hint on caching to entity stores.
See UsecaseBuilder
on how to set the metaInfo on Usecases.
Note that EntityStore implementations are not required to support caching.
Modifier and Type | Field and Description |
---|---|
static CacheOptions |
ALWAYS |
static CacheOptions |
NEVER |
Constructor and Description |
---|
CacheOptions(boolean cacheOnRead,
boolean cacheOnWrite,
boolean cacheOnNew)
Constructor for CacheOptions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cacheOnNew() |
boolean |
cacheOnRead() |
boolean |
cacheOnWrite() |
public static final CacheOptions ALWAYS
public static final CacheOptions NEVER
public CacheOptions(boolean cacheOnRead, boolean cacheOnWrite, boolean cacheOnNew)
cacheOnRead
- if true, give the hint to the Cache system that it may not be a good idea to cache the
read values. This is useful when it is known that the read will be over a large set and
shouldn't affect the existing cached entities. For instance, when traversing the EntityStore
this option is set to false.cacheOnWrite
- if true, give the hint to the Cache system that it may not be a good idea to cache the
entity when the value is updated. If this is false, the cache should be emptied from any
cached entity instead of updated. There are few cases when this is useful, and if this is
false, it makes sense that the cacheOnRead is also false.cacheOnNew
- if true, give the hint to the Cache system that it may not be a good idea to cache a newly
created Entity, as it is not likely to be read in the near future. This is useful when
batch inserts are being made.public boolean cacheOnRead()
public boolean cacheOnWrite()
public boolean cacheOnNew()