This commit is contained in:
shuzheng 2017-08-10 23:28:44 +08:00
parent cc6f118dcf
commit eec562b397
1 changed files with 30 additions and 0 deletions

View File

@ -272,4 +272,34 @@ public class RedisUtil {
}
}
/**
* 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;
}
}