コード例 #1
0
ファイル: JUnitTest.java プロジェクト: wangtaogx/realweb
 @Test
 public void testSeriableInsert() {
   config.setCodec(new SerializationCodec());
   Redisson redisson = Redisson.create(config);
   Set<User> set = redisson.getSet("handler3");
   set.add(new User("a", 1));
   set.add(new User("b", 2));
   redisson.shutdown();
 }
コード例 #2
0
ファイル: JUnitTest.java プロジェクト: wangtaogx/realweb
 @Test
 public void testJsonInsert() {
   config.setCodec(new JsonJacksonCodec());
   Redisson redisson = Redisson.create(config);
   Set<User> set = redisson.getSet("handler1");
   set.add(new User("a", 1));
   set.add(new User("b", 2));
   redisson.shutdown();
 }
コード例 #3
0
ファイル: JUnitTest.java プロジェクト: wangtaogx/realweb
 @Test
 public void testSeriableGet() {
   config.setCodec(new SerializationCodec());
   Redisson redisson = Redisson.create(config);
   Set<User> set = redisson.getSet("handler3");
   for (User u : set) {
     System.out.println(u.getName());
   }
   redisson.shutdown();
 }
コード例 #4
0
/** Created by garran on 2015/09/06. */
public class LocationRepositoryImpl implements LocationRepository {
  Redisson redisson = Connection.getConnection();
  RMap<String, Location> lists = redisson.getMap("location");

  @Override
  public Location findById(String s) {
    return lists.get(s);
  }

  @Override
  public Location save(Location entity) {
    return lists.put(entity.getId(), entity);
  }

  @Override
  public Location update(Location entity) {
    return lists.put(entity.getId(), entity);
  }

  @Override
  public void delete(Location entity) {
    lists.remove(entity.getId());
  }

  @Override
  public Set<Location> findAll() {
    Set<Location> set = new HashSet<>();
    for (Map.Entry<String, Location> entry : lists.entrySet()) {
      set.add(entry.getValue());
    }
    return set;
  }
}
コード例 #5
0
/** Created by zamzam on 15/09/09. */
public class LeaveTypeListRepositoryImpl implements LeaveTypeListRepository {
  Redisson redisson = Connection.getConnection();
  RMap<String, LeaveTypeList> lists = redisson.getMap("leaveTypeList");

  public LeaveTypeListRepositoryImpl() {}

  @Override
  public LeaveTypeList findById(String s) {
    return lists.get(s);
  }

  @Override
  public LeaveTypeList save(LeaveTypeList entity) {
    return lists.put(entity.getId(), entity);
  }

  @Override
  public LeaveTypeList update(LeaveTypeList entity) {
    return lists.put(entity.getId(), entity);
  }

  @Override
  public void delete(LeaveTypeList entity) {
    lists.remove(entity.getId());
  }

  @Override
  public Set<LeaveTypeList> findAll() {
    Set<LeaveTypeList> set = new HashSet<>();
    for (Map.Entry<String, LeaveTypeList> entry : lists.entrySet()) {
      set.add(entry.getValue());
    }
    return set;
  }
}
コード例 #6
0
 public RedissonStore(UUID sessionId, Redisson redisson) {
   this.map = redisson.getMap(sessionId.toString());
 }