Spring Data Key-Value

org.springframework.data.keyvalue.riak.core
Interface KeyValueStoreOperations

All Known Implementing Classes:
RiakKeyValueTemplate

public interface KeyValueStoreOperations

Generic abstraction for Key/Value stores. Contains most operations that generic K/V stores might expose.


Method Summary
<K> boolean
containsKey(K key)
          Does the store contain this key?
<K> boolean
deleteKeys(K... keys)
          Delete one or more keys from the store.
<K,V> V
get(K key)
          Get a value at the specified key, trying to infer the type from either the bucket in which the value was stored, or (by default) as a java.util.Map.
<K,V> V
getAndSet(K key, V value)
          Get the old value at the specified key and replace it with the given value.
<K> byte[]
getAndSetAsBytes(K key, byte[] value)
          Get the old value at the specified key as a byte array and replace it with the given bytes.
<K,V,T> T
getAndSetAsType(K key, V value, Class<T> requiredType)
          Get the old value at the specified key and replace it with the given value, converting it to an instance of the given type.
<K> byte[]
getAsBytes(K key)
          Get the value at the specified key as a byte array.
<K,T> T
getAsType(K key, Class<T> requiredType)
          Get the value at the specified key and convert it into an instance of the specified type.
<B> Map<String,Object>
getBucketSchema(B bucket)
          Get the properties of the specified bucket.
<B> Map<String,Object>
getBucketSchema(B bucket, boolean listKeys)
          Get the properties of the bucket and specify whether or not to list the keys in that bucket.
<K,V> List<V>
getValues(K... keys)
          Variation on getValues(java.util.List) that uses varargs instead of a java.util.List.
<K,V> List<V>
getValues(List<K> keys)
          Get all the values at the specified keys.
<T,K> List<T>
getValuesAsType(Class<T> requiredType, K... keys)
          A variation on getValuesAsType(java.util.List, Class) that takes uses varargs instead of a java.util.List.
<K,T> List<T>
getValuesAsType(List<K> keys, Class<T> requiredType)
          Get all the values at the specified keys, converting the values into instances of the specified type.
<K,V> KeyValueStoreOperations
set(K key, V value)
          Set a value at a specified key.
<K,V> KeyValueStoreOperations
set(K key, V value, QosParameters qosParams)
          Variation on set() that allows the user to specify QosParameters.
<K> KeyValueStoreOperations
setAsBytes(K key, byte[] value)
          Set a value as a byte array at a specified key.
<K> KeyValueStoreOperations
setAsBytes(K key, byte[] value, QosParameters qosParams)
           
<K,V> KeyValueStoreOperations
setIfKeyNonExistent(K key, V value)
          Set the value at the given key only if that key doesn't already exist.
<K> KeyValueStoreOperations
setIfKeyNonExistentAsBytes(K key, byte[] value)
          Set the value at the given key as a byte array only if that key doesn't already exist.
<K,V> KeyValueStoreOperations
setMultiple(Map<K,V> keysAndValues)
          Convenience method to set multiple values as Key/Value pairs.
<K> KeyValueStoreOperations
setMultipleAsBytes(Map<K,byte[]> keysAndValues)
          Convenience method to set multiple values as Key/byte[] pairs.
<K> KeyValueStoreOperations
setMultipleAsBytesIfKeysNonExistent(Map<K,byte[]> keysAndValues)
          Variation on setting multiple values as byte arrays only if the key doesn't already exist.
<K,V> KeyValueStoreOperations
setMultipleIfKeysNonExistent(Map<K,V> keysAndValues)
          Variation on setting multiple values only if the key doesn't already exist.
<K,V> KeyValueStoreOperations
setWithMetaData(K key, V value, Map<String,String> metaData)
           
<K,V> KeyValueStoreOperations
setWithMetaData(K key, V value, Map<String,String> metaData, QosParameters qosParams)
          Variation on setWithMetaData() that allows the user to pass QosParameters.
<B> KeyValueStoreOperations
updateBucketSchema(B bucket, Map<String,Object> props)
           
 

Method Detail

set

<K,V> KeyValueStoreOperations set(K key,
                                  V value)
Set a value at a specified key.

Parameters:
key -
value -
Returns:
This template interface

set

<K,V> KeyValueStoreOperations set(K key,
                                  V value,
                                  QosParameters qosParams)
Variation on set() that allows the user to specify QosParameters.

Type Parameters:
K -
V -
Parameters:
key -
value -
qosParams -
Returns:

setAsBytes

<K> KeyValueStoreOperations setAsBytes(K key,
                                       byte[] value)
Set a value as a byte array at a specified key.

Parameters:
key -
value -
Returns:
This template interface

setWithMetaData

<K,V> KeyValueStoreOperations setWithMetaData(K key,
                                              V value,
                                              Map<String,String> metaData,
                                              QosParameters qosParams)
Variation on setWithMetaData() that allows the user to pass QosParameters.

Type Parameters:
K -
V -
Parameters:
key -
value -
metaData -
qosParams -
Returns:

get

<K,V> V get(K key)
Get a value at the specified key, trying to infer the type from either the bucket in which the value was stored, or (by default) as a java.util.Map.

Parameters:
key -
Returns:
The converted value, or null if not found.

getAsBytes

<K> byte[] getAsBytes(K key)
Get the value at the specified key as a byte array.

Parameters:
key -
Returns:
The byte array of data, or null if not found.

getAsType

<K,T> T getAsType(K key,
                  Class<T> requiredType)
Get the value at the specified key and convert it into an instance of the specified type.

Parameters:
key -
requiredType -
Returns:
The converted value, or null if not found.

getAndSet

<K,V> V getAndSet(K key,
                  V value)
Get the old value at the specified key and replace it with the given value.

Parameters:
key -
value -
Returns:
The old value (before it was overwritten).

getAndSetAsBytes

<K> byte[] getAndSetAsBytes(K key,
                            byte[] value)
Get the old value at the specified key as a byte array and replace it with the given bytes.

Parameters:
key -
value -
Returns:
The old byte array (before it was overwritten).

getAndSetAsType

<K,V,T> T getAndSetAsType(K key,
                          V value,
                          Class<T> requiredType)
Get the old value at the specified key and replace it with the given value, converting it to an instance of the given type.

Parameters:
key -
value -
requiredType - The type to convert the value to.
Returns:
The old value (before it was overwritten).

getValues

<K,V> List<V> getValues(List<K> keys)
Get all the values at the specified keys.

Parameters:
keys -
Returns:
A list of the values retrieved or an empty list if none were found.

getValues

<K,V> List<V> getValues(K... keys)
Variation on getValues(java.util.List) that uses varargs instead of a java.util.List.

Parameters:
keys -
Returns:
A list of the values retrieved or an empty list if none were found.

getValuesAsType

<K,T> List<T> getValuesAsType(List<K> keys,
                              Class<T> requiredType)
Get all the values at the specified keys, converting the values into instances of the specified type.

Parameters:
keys -
requiredType -
Returns:
A list of the values retrieved or an empty list if none were found.

getValuesAsType

<T,K> List<T> getValuesAsType(Class<T> requiredType,
                              K... keys)
A variation on getValuesAsType(java.util.List, Class) that takes uses varargs instead of a java.util.List.

Parameters:
requiredType -
keys -
Returns:
A list of the values retrieved or an empty list if none were found.

setIfKeyNonExistent

<K,V> KeyValueStoreOperations setIfKeyNonExistent(K key,
                                                  V value)
Set the value at the given key only if that key doesn't already exist.

Parameters:
key -
value -
Returns:
This template interface

setIfKeyNonExistentAsBytes

<K> KeyValueStoreOperations setIfKeyNonExistentAsBytes(K key,
                                                       byte[] value)
Set the value at the given key as a byte array only if that key doesn't already exist.

Parameters:
key -
value -
Returns:
This template interface

setMultiple

<K,V> KeyValueStoreOperations setMultiple(Map<K,V> keysAndValues)
Convenience method to set multiple values as Key/Value pairs.

Parameters:
keysAndValues -
Returns:
This template interface

setMultipleAsBytes

<K> KeyValueStoreOperations setMultipleAsBytes(Map<K,byte[]> keysAndValues)
Convenience method to set multiple values as Key/byte[] pairs.

Parameters:
keysAndValues -
Returns:
This template interface

setMultipleIfKeysNonExistent

<K,V> KeyValueStoreOperations setMultipleIfKeysNonExistent(Map<K,V> keysAndValues)
Variation on setting multiple values only if the key doesn't already exist.

Parameters:
keysAndValues -
Returns:
This template interface

setMultipleAsBytesIfKeysNonExistent

<K> KeyValueStoreOperations setMultipleAsBytesIfKeysNonExistent(Map<K,byte[]> keysAndValues)
Variation on setting multiple values as byte arrays only if the key doesn't already exist.

Type Parameters:
K -
Parameters:
keysAndValues -
Returns:

containsKey

<K> boolean containsKey(K key)
Does the store contain this key?

Parameters:
key -
Returns:
true if the key exists, false otherwise.

deleteKeys

<K> boolean deleteKeys(K... keys)
Delete one or more keys from the store.

Parameters:
keys -
Returns:
true if all keys were successfully deleted, false otherwise.

getBucketSchema

<B> Map<String,Object> getBucketSchema(B bucket)
Get the properties of the specified bucket.

Parameters:
bucket -
Returns:
The bucket properties, without a list of keys in that bucket.

updateBucketSchema

<B> KeyValueStoreOperations updateBucketSchema(B bucket,
                                               Map<String,Object> props)

getBucketSchema

<B> Map<String,Object> getBucketSchema(B bucket,
                                       boolean listKeys)
Get the properties of the bucket and specify whether or not to list the keys in that bucket.

Parameters:
bucket -
listKeys -
Returns:
The bucket properties, with or without a list of keys in that bucket.

setAsBytes

<K> KeyValueStoreOperations setAsBytes(K key,
                                       byte[] value,
                                       QosParameters qosParams)

setWithMetaData

<K,V> KeyValueStoreOperations setWithMetaData(K key,
                                              V value,
                                              Map<String,String> metaData)

Spring Data Key-Value

Copyright © 2010 SpringSource. All Rights Reserved.