DATAREDIS-197 - Expose bit-related ops via ValueOperations.
Polishing. Added -S switch to gradlew in makefile for better Stacktrace reporting. Original pull request: #96.
This commit is contained in:
committed by
Thomas Darimont
parent
ba1d22847d
commit
9ecad07587
@@ -244,4 +244,29 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean setBit(K key, final long offset, final boolean value) {
|
||||
|
||||
final byte[] rawKey = rawKey(key);
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.setBit(rawKey, offset, value);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getBit(K key, final long offset) {
|
||||
|
||||
final byte[] rawKey = rawKey(key);
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.getBit(rawKey, offset);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,4 +66,22 @@ public interface ValueOperations<K, V> {
|
||||
Long size(K key);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
/**
|
||||
* @since 1.5
|
||||
* @param key
|
||||
* @param offset
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
Boolean setBit(K key, long offset, boolean value);
|
||||
|
||||
/**
|
||||
* @since 1.5
|
||||
* @param key
|
||||
* @param offset
|
||||
* @return
|
||||
*/
|
||||
Boolean getBit(K key, long offset);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user