Package org.springframework.data.gemfire
Interface GemfireOperations
- All Known Implementing Classes:
GemfireTemplate
public interface GemfireOperations
GemfireOperations
defines the {Region
data access operations that can be performed
using the Template software design pattern.- See Also:
-
Region
QueryService
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Object key) boolean
boolean
containsValue
(Object value) boolean
<K,
V> void create
(K key, V value) <T> T
execute
(GemfireCallback<T> action) Execute the action specified by the given action object within a Region.<T> T
execute
(GemfireCallback<T> action, boolean exposeNativeRegion) Execute the action specified by the given action object within a Region.<E> org.apache.geode.cache.query.SelectResults<E>
Executes a GemFire query with the given (optional) parameters and returns the result.<T> T
findUnique
(String query, Object... params) Executes a GemFire query with the given (optional) parameters and returns the result.<K,
V> V get
(K key) default <K,
V> Map<K, V> getAll
(Collection<?> keys) <K,
V> V put
(K key, V value) default <K,
V> void <K,
V> V putIfAbsent
(K key, V value) <E> org.apache.geode.cache.query.SelectResults<E>
Shortcut forRegion.query(String)
method.<K,
V> V remove
(K key) default void
removeAll
(Collection<?> keys) <K,
V> V replace
(K key, V value) <K,
V> boolean replace
(K key, V oldValue, V newValue)
-
Method Details
-
containsKey
-
containsKeyOnServer
-
containsValue
-
containsValueForKey
-
create
<K,V> void create(K key, V value) -
get
<K,V> V get(K key) -
getAll
-
put
<K,V> V put(K key, V value) -
putAll
-
putIfAbsent
<K,V> V putIfAbsent(K key, V value) -
remove
<K,V> V remove(K key) -
removeAll
-
replace
<K,V> V replace(K key, V value) -
replace
<K,V> boolean replace(K key, V oldValue, V newValue) -
find
<E> org.apache.geode.cache.query.SelectResults<E> find(String query, Object... params) throws org.springframework.dao.InvalidDataAccessApiUsageException Executes a GemFire query with the given (optional) parameters and returns the result. Note this method expects the query to return multiple results; for queries that return only one element usefindUnique(String, Object...)
. As oppose, to thequery(String)
method, this method allows for more generic queries (against multiple regions even) to be executed. Note that the local query service is used if the region is configured as a client without any pool configuration or server connectivity - otherwise the query service on the default pool is being used.- Type Parameters:
E
- type parameter specifying the type of the select results.- Parameters:
query
- the OQL query statement to execute.params
- an array of Object values used as arguments to bind to the OQL query parameters (such as $1).- Returns:
- A
SelectResults
instance holding the objects matching the query - Throws:
org.springframework.dao.InvalidDataAccessApiUsageException
- in case the query returns a single result (not aSelectResults
).- See Also:
-
QueryService.newQuery(String)
Query.execute(Object[])
SelectResults
-
findUnique
<T> T findUnique(String query, Object... params) throws org.springframework.dao.InvalidDataAccessApiUsageException Executes a GemFire query with the given (optional) parameters and returns the result. Note this method expects the query to return a single result; for queries that return multiple elements usefind(String, Object...)
. As oppose, to thequery(String)
method, this method allows for more generic queries (against multiple regions even) to be executed. Note that the local query service is used if the region is configured as a client without any pool configuration or server connectivity - otherwise the query service on the default pool is being used.- Type Parameters:
T
- type parameter specifying the returned result type.- Parameters:
query
- the OQL query statement to execute.params
- an array of Object values used as arguments to bind to the OQL query parameters (such as $1).- Returns:
- The (single) object that represents the result of the query.
- Throws:
org.springframework.dao.InvalidDataAccessApiUsageException
- in case the query returns multiple objects (throughSelectResults
).- See Also:
-
QueryService.newQuery(String)
Query.execute(Object[])
-
query
Shortcut forRegion.query(String)
method. Filters the values of this region using the predicate given as a string with the syntax of the WHERE clause of the query language. The predefined variable this may be used inside the predicate to denote the current element being filtered. This method evaluates the passed in where clause and returns results. It is supported on servers as well as clients. When executed on a client, this method always runs on the server and returns results. When invoking this method from the client, applications can pass in a where clause or a complete query.- Type Parameters:
E
- type parameter specifying the type of the select results.- Parameters:
query
- an OQL Query language boolean query predicate.- Returns:
- A SelectResults containing the values of this Region that match the predicate.
- See Also:
-
Region.query(String)
-
execute
Execute the action specified by the given action object within a Region.- Type Parameters:
T
- type parameter specifying the returned result type.- Parameters:
action
- callback object that specifies the Gemfire action to execute.- Returns:
- a result object returned by the action, or
null
. - Throws:
org.springframework.dao.DataAccessException
- in case of GemFire errors.
-
execute
<T> T execute(GemfireCallback<T> action, boolean exposeNativeRegion) throws org.springframework.dao.DataAccessException Execute the action specified by the given action object within a Region.- Type Parameters:
T
- type parameter specifying the returned result type.- Parameters:
action
- callback object that specifies the Gemfire action to execute.exposeNativeRegion
- whether to expose the native GemFire region to callback code.- Returns:
- a result object returned by the action, or
null
. - Throws:
org.springframework.dao.DataAccessException
- in case of GemFire errors.
-