source: class AccessSpeedLimitTest {
  
      @Test
      public void test2() throws InterruptedException {
  
target:         JedisPool jp=new JedisPool("127.0.0.1",6379);
  //        final RedisDistributedLockTemplate template=new RedisDistributedLockTemplate(jp);
          LimitRule limitRule=new LimitRule();
          limitRule.setSeconds(1);
          limitRule.setLimitCount(5);
          limitRule.setLockCount(7);
          limitRule.setLockTime(2);
          AccessSpeedLimit accessSpeedLimit=new AccessSpeedLimit(jp);
          SimpleDateFormat sdf=new SimpleDateFormat(" mm:ss");
          while(true){
              //10.0.0.1这个ip每1秒钟最多访问5次if块内代码.1秒超过10次后,锁定2秒,2秒内无法访问.
              if(accessSpeedLimit.tryAccess("10.0.0.1",limitRule)){
                  System.out.println("yes"+sdf.format(new Date()));
              }else{
                  System.out.println("no"+sdf.format(new Date()));
              }
              Thread.sleep(100);
          }
      }
  
  }