() {
+
+ @Override
+ public String action(Jedis jedis) {
+ return jedis.getSet(key, value);
+ }
+ });
+ }
+
+ /**
+ * Increment the number stored at key by one. If the key does not exist or
+ * contains a value of a wrong type, set the key to the value of "0" before
+ * to perform the increment operation.
+ *
+ * INCR commands are limited to 64 bit signed integers.
+ *
+ * Note: this is actually a string operation, that is, in Redis there are
+ * not "integer" types. Simply the string stored at the key is parsed as a
+ * base 10 64 bit signed integer, incremented, and then converted back as a
+ * string.
+ *
+ * @return Integer reply, this commands will reply with the new value of key
+ * after the increment.
+ */
+ public Long incr(final String key) {
+ return execute(new JedisAction() {
+ @Override
+ public Long action(Jedis jedis) {
+ return jedis.incr(key);
+ }
+ });
+ }
+
+ public Long incrBy(final String key, final long increment) {
+ return execute(new JedisAction() {
+ @Override
+ public Long action(Jedis jedis) {
+ return jedis.incrBy(key, increment);
+ }
+ });
+ }
+
+ public Double incrByFloat(final String key, final double increment) {
+ return execute(new JedisAction() {
+ @Override
+ public Double action(Jedis jedis) {
+ return jedis.incrByFloat(key, increment);
+ }
+ });
+ }
+
+ /**
+ * Decrement the number stored at key by one. If the key does not exist or
+ * contains a value of a wrong type, set the key to the value of "0" before
+ * to perform the decrement operation.
+ */
+ public Long decr(final String key) {
+ return execute(new JedisAction() {
+ @Override
+ public Long action(Jedis jedis) {
+ return jedis.decr(key);
+ }
+ });
+ }
+
+ public Long decrBy(final String key, final long decrement) {
+ return execute(new JedisAction() {
+ @Override
+ public Long action(Jedis jedis) {
+ return jedis.decrBy(key, decrement);
+ }
+ });
+ }
+
+ // / Hash Actions ///
+ /**
+ * If key holds a hash, retrieve the value associated to the specified
+ * field.
+ *
+ * If the field is not found or the key does not exist, a special 'nil'
+ * value is returned.
+ */
+ public String hget(final String key, final String fieldName) {
+ return execute(new JedisAction() {
+ @Override
+ public String action(Jedis jedis) {
+ return jedis.hget(key, fieldName);
+ }
+ });
+ }
+
+ public List hmget(final String key, final String... fieldsNames) {
+ return execute(new JedisAction>() {
+ @Override
+ public List action(Jedis jedis) {
+ return jedis.hmget(key, fieldsNames);
+ }
+ });
+ }
+
+ public Map hgetAll(final String key) {
+ return execute(new JedisAction