Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shuzheng committed Aug 10, 2017
1 parent cc6f118 commit eec562b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions zheng-common/src/main/java/com/zheng/common/util/RedisUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,34 @@ public synchronized static void sadd(String key, String value, int seconds) {
}
}

/**
* incr
* @param key
* @return value
*/
public synchronized static Long incr(String key) {
Jedis jedis = getJedis();
if (null == jedis) {
return null;
}
long value = jedis.incr(key);
jedis.close();
return value;
}

/**
* decr
* @param key
* @return value
*/
public synchronized static Long decr(String key) {
Jedis jedis = getJedis();
if (null == jedis) {
return null;
}
long value = jedis.decr(key);
jedis.close();
return value;
}

}

0 comments on commit eec562b

Please sign in to comment.