コード例 #1
0
 @Override
 public int deleteAdWall(int id) {
   AdWall t = getAdWall(id);
   int result = adWallDAO.delete(id);
   if (result > 0) {
     flushRedis(t.getPositionType());
   }
   return result;
 }
コード例 #2
0
 @Override
 public int updateAdWall(AdWall t) {
   int result = adWallDAO.update(t);
   if (result > 0) {
     flushRedis(t.getPositionType());
   }
   return result;
 }
コード例 #3
0
 @Override
 public int addAdWall(AdWall t) {
   int result = adWallDAO.insert(t);
   if (result > 0) {
     flushRedis(t.getPositionType());
   }
   return result;
 }
コード例 #4
0
 @Override
 public List<AdWall> queryAdWallFromRedis(String positionType) {
   RedisPool redisPool = null;
   List<AdWall> filterList = new ArrayList<>();
   try {
     redisPool = RedisUtil.getRedisPool("user");
     List<AdWall> list = redisPool.lrange(AD_REDIS_KEY + ":" + positionType, AdWall.class, 0, -1);
     for (AdWall ad : list) {
       if (new Date().getTime() >= ad.getBeginDate().getTime()
           && ad.getEndDate().getTime() >= new Date().getTime()) {
         filterList.add(ad);
       }
     }
     return filterList;
   } catch (Exception e) {
     // ingnore
   }
   return null;
 }