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:
David Liu
2014-08-21 07:19:25 +08:00
committed by Thomas Darimont
parent ba1d22847d
commit 9ecad07587
4 changed files with 70 additions and 5 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}