public enum CacheSyncStrategy extends java.lang.Enum<CacheSyncStrategy> implements ValueEnum
automatic cache
synchronization
, for a given DataSource
, OperationBinding
or DSRequest
. Enum Constant and Description |
---|
NONE
This strategy does not attempt to derive cache sync data at all.
|
REFETCH
Obtain cache sync values by refetching the record we just updated or added.
|
REQUESTVALUESPLUSSEQUENCES
Obtain cache sync values by merging the request values on top of the request's
oldValues . |
RESPONSEVALUES
This strategy simply returns the data returned by the add or update operation, as the cache sync data.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getValue() |
static CacheSyncStrategy |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static CacheSyncStrategy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CacheSyncStrategy REFETCH
primary key fields
of type sequence
, the framework
will first attempt to obtain values for those fields - see sequenceMode
.
This is the most complete and foolproof way to get cache sync data, because we pick up any changes to the record
that were applied by the persistence layer - for example database default values, values applied by database triggers
or transformations applied to the record we sent by a remote REST service or legacy program call. However, it is also
the least performant, since it involves a full refetch of the data. This is the default strategy for SQL DataSources
and custom DataSources
. It is also the strategy used for Hibernate
and JPA
DataSources, though for these two, it is implemented inherently
by the ORM system and you should not attempt to change it. See the cache synchronization overview
for details
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "refetch".
public static final CacheSyncStrategy REQUESTVALUESPLUSSEQUENCES
oldValues
. If the DataSource contains primary key fields
of type sequence
, the framework
will then attempt to obtain values for those fields - see sequenceMode
-
and merge those values into the cache sync data as well. This strategy avoids a data refetch, which may be a significant
performance gain. Despite the name, this strategy is also suitable and effective for situations where your keys are not
sequences - for example, when they are GUIDs or when they are user-entered codes. In this case, we simply do not attempt
to resolve sequence values, and since the key values are already included in the request values, everything works
Note, if no oldValues
are available and the updated record is incomplete
, or if the combination of oldValues
and values is missing a value for a required field
for any
other reason, this strategy will return incomplete cache sync data. For details of what we do in these circumstances,
see the "CacheSyncStrategy" section of the cache synchronization
overview
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "requestValuesPlusSequences".
public static final CacheSyncStrategy RESPONSEVALUES
DataSource
types that return a value for an update operation. This may include generic
DataSources and RestConnector
s, depending entirely on what the implementation returns. It specifically
does not include SQL DataSources
, because SQL/JDBC update operations do
not return a value (other than the number of affected records). This is the default strategy for RestConnector
s, because it was the default way we did cache sync for that
DataSource type before CacheSyncStrategy
was introduced (and also because it is the ideal strategy for
REST services that return the record-as-updated). See DataSource.cacheSyncStrategy
for details of how to change the default strategy for a given dataSource type.
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "responseValues".
public static final CacheSyncStrategy NONE
cache invalidation
If this enumerated value is used in a Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "none".
public static CacheSyncStrategy[] values()
for (CacheSyncStrategy c : CacheSyncStrategy.values()) System.out.println(c);
public static CacheSyncStrategy valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null