示例#1
0
 @Override
 public V last() {
   V res = commandExecutor.read(getName(), codec, RedisCommands.LINDEX, getName(), -1);
   if (res == null) {
     throw new NoSuchElementException();
   }
   return res;
 }
示例#2
0
 @Override
 public boolean contains(final Object o) {
   return commandExecutor.read(
       getName(),
       codec,
       new SyncOperation<Boolean>() {
         @Override
         public Boolean execute(Codec codec, RedisConnection conn) {
           return binarySearch((V) o, codec, conn).getIndex() >= 0;
         }
       });
 }
示例#3
0
 private void loadComparator() {
   commandExecutor.read(
       getName(),
       codec,
       new SyncOperation<Void>() {
         @Override
         public Void execute(Codec codec, RedisConnection conn) {
           loadComparator(conn);
           return null;
         }
       });
 }
示例#4
0
 @Override
 public <T> T[] toArray(T[] a) {
   List<V> res = commandExecutor.read(getName(), codec, RedisCommands.LRANGE, getName(), 0, -1);
   return res.toArray(a);
 }
示例#5
0
 private V get(final int index) {
   return commandExecutor.read(getName(), codec, RedisCommands.LINDEX, getName(), index);
 }
示例#6
0
 @Override
 public int size() {
   return commandExecutor.read(getName(), codec, RedisCommands.LLEN_INT, getName());
 }