コード例 #1
0
 public void zDelByRank(String cacheKey, long startIndex, long endIndex) throws Exception {
   ShardedJedis jedis = null;
   try {
     jedis = jedisPool.getResource();
     jedis.zremrangeByRank(cacheKey, startIndex, endIndex);
   } catch (Exception e) {
     throw e;
   } finally {
     if (jedis != null) {
       jedisPool.returnResource(jedis);
     }
   }
 }
コード例 #2
0
 /**
  * 通过key删除给定区间内的元素
  *
  * @param key
  * @param start
  * @param end
  * @return
  */
 public Long zremrangeByRank(String key, long start, long end) {
   ShardedJedis jedis = null;
   Long res = null;
   try {
     jedis = pool.getResource();
     res = jedis.zremrangeByRank(key, start, end);
   } catch (Exception e) {
     pool.returnBrokenResource(jedis);
     e.printStackTrace();
   } finally {
     returnResource(pool, jedis);
   }
   return res;
 }