Enum CacheSyncStrategy
- All Implemented Interfaces:
ValueEnum
,Serializable
,Comparable<CacheSyncStrategy>
,Constable
automatic cache
synchronization
, for a given DataSource
, OperationBinding
or DSRequest
. -
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThis strategy does not attempt to derive cache sync data at all.Obtain cache sync values by refetching the record we just updated or added.Obtain cache sync values by merging the request values on top of the request'soldValues
.This strategy simply returns the data returned by the add or update operation, as the cache sync data. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()
static CacheSyncStrategy
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.
-
Enum Constant Details
-
REFETCH
Obtain cache sync values by refetching the record we just updated or added. If the DataSource containsprimary key fields
of typesequence
, the framework will first attempt to obtain values for those fields - seesequenceMode
.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
andcustom DataSources
. It is also the strategy used forHibernate
andJPA
DataSources, though for these two, it is implemented inherently by the ORM system and you should not attempt to change it. See thecache synchronization overview
for detailsIf this enumerated value is used in a
Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "refetch". -
REQUESTVALUESPLUSSEQUENCES
Obtain cache sync values by merging the request values on top of the request'soldValues
. If the DataSource containsprimary key fields
of typesequence
, the framework will then attempt to obtain values for those fields - seesequenceMode
- 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 worksNote, if no
oldValues
are available and the updated record isincomplete
, or if the combination ofoldValues
and values is missing a value for arequired 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 thecache 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". -
RESPONSEVALUES
This strategy simply returns the data returned by the add or update operation, as the cache sync data. This only makes sense forDataSource
types that return a value for an update operation. This may include generic DataSources andRestConnector
s, depending entirely on what the implementation returns. It specifically does not includeSQL 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 beforeCacheSyncStrategy
was introduced (and also because it is the ideal strategy for REST services that return the record-as-updated). SeeDataSource.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". -
NONE
This strategy does not attempt to derive cache sync data at all. No response data is sent back to the caller, and the response is marked forcache invalidation
If this enumerated value is used in a
Component XML
file or server-side DataSource descriptor (.ds.xml file), use the value "none".
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getValue
-