Java Code Examples for org.redisson.api.RList#get()

The following examples show how to use org.redisson.api.RList#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisJobRepositoryImpl.java    From earth-frost with Apache License 2.0 6 votes vote down vote up
@Override
public JobInfo findJobInfoById(String id) {
  RMap<String, JobInfo> map = redissonClient.getMap(Container.JOB_INFO);
  JobInfo jobInfo = map.get(id);
  if (jobInfo == null) {
    return null;
  }
  RListMultimap<String, JobScript> scriptList = redissonClient
      .getListMultimap(Container.JOB_INFO_SCRIPT);
  RList<JobScript> list = scriptList.get(id);
  int size = list.size();
  if (size > 0) {
    JobScript script = list.get(size - 1);
    jobInfo.setScript(script.getScript());
  }
  return jobInfo;
}
 
Example 2
Source File: RedisStorage.java    From Panako with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public long[] get(int hashtableIndex, int key) {
	RList<Long> values = hashtables.get(hashtableIndex).get(key);
	long[] asLongArray = new long[values.size()];
	for(int i = 0 ; i<asLongArray.length ; i++){
		asLongArray[i] = values.get(i);
	}
	return asLongArray;
}
 
Example 3
Source File: ListExamples.java    From redisson-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    // connects to 127.0.0.1:6379 by default
    RedissonClient redisson = Redisson.create();
    
    RList<String> list = redisson.getList("myList");
    list.add("1");
    list.add("2");
    list.add("3");
    
    list.contains("1");
    
    String valueAtIndex = list.get(3);
    
    for (String string : list) {
        // iteration through bulk loaded values
    }
    
    boolean removedValue = list.remove("1");
    list.removeAll(Arrays.asList("1", "2", "3"));
    list.containsAll(Arrays.asList("4", "1", "0"));
    
    List<String> secondList = new ArrayList<>();
    secondList.add("4");
    secondList.add("5");
    list.addAll(secondList);

    // fetch all objects
    List<String> allValues = list.readAll();

    list.addAfter("3", "7");
    list.addBefore("4", "6");
    
    // use fast* methods when previous value is not required
    list.fastSet(1, "6");
    list.fastRemove(3);
    
    redisson.shutdown();
}