redis-string-统计

package com.ztest.redis.string;

import org.junit.Test;

import redis.clients.jedis.Jedis;

import com.ztest.redis.util.JedisConnectionUtil;

public class StatTest {

@Test
public void statTest(){
Jedis jedis = JedisConnectionUtil.initJedis();
jedis.flushAll();

String date1 = "2016-06-20";
String date2 = "2016-06-21";
String date3 = "2016-06-22";

for (long i = 0 ; i < 10 ; i++ ){
if(i % 2 == 0){
jedis.setbit(date1, i, true);
}
}

for (long i = 0 ; i < 10 ; i++ ){
if(i % 3 == 0){
jedis.setbit(date2, i, true);
}
}


for (long i = 0 ; i < 10 ; i++ ){
if(i % 4 == 0){
jedis.setbit(date3, i, true);
}
}


}
}

posted @ 2016-06-22 18:19  浮白斋主人  阅读(279)  评论(0编辑  收藏  举报