admin
2020-07-04 e04f81915e100107eca5fe16ba44898f3a0dbd55
fanli/src/main/java/com/yeshi/fanli/util/RedisManager.java
@@ -50,6 +50,11 @@
   @Resource
   private ConfigService configService;
    public Jedis getJedis() {
        Jedis jedis = jedisPool.getResource();
        return jedis;
    }
   /**
    * 缓存字符串
    * 
@@ -57,7 +62,7 @@
    * @param value
    */
   private void setString(String key, String value) {
      Jedis jedis = jedisPool.getResource();
        Jedis jedis = getJedis();
      SetParams params=new SetParams().nx().ex(60);
      jedis.set(key, value, params);
      try {
@@ -75,7 +80,7 @@
    * @param value
    */
   private void removeKey(String key) {
      Jedis jedis = jedisPool.getResource();
        Jedis jedis = getJedis();
      try {
         jedis.del(key);
      } finally {
@@ -89,11 +94,10 @@
    * 
    * @param key
    * @param value
    * @param seconds
    *            -缓存时间(s)
     * @param seconds -缓存时间(s)
    */
   private void setString(String key, String value, int seconds) {
      Jedis jedis = jedisPool.getResource();
        Jedis jedis = getJedis();
      try {
         jedis.setex(key, seconds, value);
      } finally {
@@ -102,7 +106,7 @@
   }
   private String getString(String key) {
      Jedis jedis = jedisPool.getResource();
        Jedis jedis = getJedis();
      try {
         return jedis.get(key);
      } finally {
@@ -111,7 +115,7 @@
   }
   public void increase(String key) {
      Jedis jedis = jedisPool.getResource();
        Jedis jedis = getJedis();
      try {
         jedis.incr(key);
      } finally {
@@ -120,7 +124,7 @@
   }
   public void expire(String key, int seconds) {
      Jedis jedis = jedisPool.getResource();
        Jedis jedis = getJedis();
      try {
         jedis.expire(key, seconds);
      } finally {
@@ -256,7 +260,7 @@
    */
   public boolean ipFrequencyLimit(String ip, String apiName) {
      String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, ip + "-" + StringUtil.Md5(apiName));
      Jedis jedis = jedisPool.getResource();
        Jedis jedis = getJedis();
      try {
         long count = jedis.incr(key);
         if (count == 1)
@@ -272,7 +276,7 @@
   public boolean frequencyLimit(String key, int timeS, int num) {
      key = RedisKeyEnum.getRedisKey(RedisKeyEnum.frequencyLimit, key);
      Jedis jedis = jedisPool.getResource();
        Jedis jedis = getJedis();
      try {
         long count = jedis.incr(key);
         if (count == 1)
@@ -414,7 +418,6 @@
   }
   /**
    *
    * @param phone
    * @param type
    * @return