Package com.smartgwt.client.types

# Enum CacheSyncStrategy

java.lang.Object
java.lang.Enum<CacheSyncStrategy>
com.smartgwt.client.types.CacheSyncStrategy

All Implemented Interfaces:
  `ValueEnum`, `Serializable`, `Comparable<CacheSyncStrategy>`, `Constable`

public enum CacheSyncStrategy extends Enum<CacheSyncStrategy> implements ValueEnum
Indicates the strategy to be used for `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 Constants
  Enum Constant
  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.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getValue()`
  `static CacheSyncStrategy`
  `valueOf(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.

  ### Methods inherited from class java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### REFETCH

    public static final CacheSyncStrategy REFETCH
    Obtain cache sync values by refetching the record we just updated or added. If the DataSource contains `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".

  - ### REQUESTVALUESPLUSSEQUENCES

    public static final CacheSyncStrategy REQUESTVALUESPLUSSEQUENCES
    Obtain cache sync values by merging the request values on top of the request's `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 (though please see the note in the `sequenceMode` documentation regarding Oracle as a special case in this regard). 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".

  - ### RESPONSEVALUES

    public static final CacheSyncStrategy RESPONSEVALUES
    This strategy simply returns the data returned by the add or update operation, as the cache sync data. This only makes sense for `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".

  - ### NONE

    public static final CacheSyncStrategy 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 for `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".

- ## Method Details

  - ### values

    public static CacheSyncStrategy[] 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

    public static CacheSyncStrategy valueOf(String name)
    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 name
      `NullPointerException` - if the argument is null

  - ### getValue

    public String getValue()
    Specified by:
      `getValue` in interface `ValueEnum`