@Override public boolean add(E value) { listOps.rightPush(value); cap(); return true; }
@Override public boolean offer(E e) { listOps.rightPush(e); cap(); return true; }
@Override public void add(int index, E element) { if (index == 0) { listOps.leftPush(element); cap(); return; } int size = size(); if (index == size()) { listOps.rightPush(element); cap(); return; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
@Override public boolean addAll(int index, Collection<? extends E> c) { // insert collection in reverse if (index == 0) { Collection<? extends E> reverseC = CollectionUtils.reverse(c); for (E e : reverseC) { listOps.leftPush(e); cap(); } return true; } int size = size(); if (index == size()) { for (E e : c) { listOps.rightPush(e); cap(); } return true; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
protected void prepareList(RedisConnectionFactory connectionFactory) { StringRedisTemplate redisTemplate = createStringRedisTemplate(connectionFactory); redisTemplate.delete("presidents"); BoundListOperations<String, String> ops = redisTemplate.boundListOps("presidents"); ops.rightPush("John Adams"); ops.rightPush("Barack Obama"); ops.rightPush("Thomas Jefferson"); ops.rightPush("John Quincy Adams"); ops.rightPush("Zachary Taylor"); ops.rightPush("Theodore Roosevelt"); ops.rightPush("Woodrow Wilson"); ops.rightPush("George W. Bush"); ops.rightPush("Franklin D. Roosevelt"); ops.rightPush("Ronald Reagan"); ops.rightPush("William J. Clinton"); ops.rightPush("Abraham Lincoln"); ops.rightPush("George Washington"); }
@Override @SuppressWarnings("unchecked") protected void handleMessageInternal(Message<?> message) throws Exception { Object value = message; if (this.extractPayload) { value = message.getPayload(); } if (!(value instanceof byte[])) { if (value instanceof String && !this.serializerExplicitlySet) { value = this.stringSerializer.serialize((String) value); } else { value = ((RedisSerializer<Object>) this.serializer).serialize(value); } } String queueName = this.queueNameExpression.getValue(this.evaluationContext, message, String.class); // TODO: 5.2 assert both not null if (this.leftPush) { this.template.boundListOps(queueName).leftPush(value); // NOSONAR } else { this.template.boundListOps(queueName).rightPush(value); // NOSONAR } }
if (value != null) { if (!this.active) { this.boundListOperations.rightPush(value); return; if (value != null) { if (!this.active) { this.template.boundListOps(uuid).rightPush(value); byte[] serialized = stringSerializer.serialize(uuid); if (serialized != null) { this.boundListOperations.rightPush(serialized);
this.boundListOperations.rightPush(value);
@Override public boolean add(E value) { listOps.rightPush(value); cap(); return true; }
verify(boundListOperations, atLeastOnce()).rightPush(any(byte[].class));
@Override public boolean offer(E e) { listOps.rightPush(e); cap(); return true; }
@Override public boolean offer(E e) { listOps.rightPush(e); cap(); return true; }
@Override public boolean add(E value) { listOps.rightPush(value); cap(); return true; }
@Override public void add(int index, E element) { if (index == 0) { listOps.leftPush(element); cap(); return; } int size = size(); if (index == size()) { listOps.rightPush(element); cap(); return; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
@Override public void add(int index, E element) { if (index == 0) { listOps.leftPush(element); cap(); return; } int size = size(); if (index == size()) { listOps.rightPush(element); cap(); return; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
@Override @SuppressWarnings("unchecked") protected void handleMessageInternal(Message<?> message) throws Exception { Object value = message; if (this.extractPayload) { value = message.getPayload(); } if (!(value instanceof byte[])) { if (value instanceof String && !this.serializerExplicitlySet) { value = this.stringSerializer.serialize((String) value); } else { value = ((RedisSerializer<Object>) this.serializer).serialize(value); } } String queueName = this.queueNameExpression.getValue(this.evaluationContext, message, String.class); // TODO: 5.2 assert both not null if (this.leftPush) { this.template.boundListOps(queueName).leftPush(value); // NOSONAR } else { this.template.boundListOps(queueName).rightPush(value); // NOSONAR } }
@Override public boolean addAll(int index, Collection<? extends E> c) { // insert collection in reverse if (index == 0) { Collection<? extends E> reverseC = CollectionUtils.reverse(c); for (E e : reverseC) { listOps.leftPush(e); cap(); } return true; } int size = size(); if (index == size()) { for (E e : c) { listOps.rightPush(e); cap(); } return true; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
@Override public boolean addAll(int index, Collection<? extends E> c) { // insert collection in reverse if (index == 0) { Collection<? extends E> reverseC = CollectionUtils.reverse(c); for (E e : reverseC) { listOps.leftPush(e); cap(); } return true; } int size = size(); if (index == size()) { for (E e : c) { listOps.rightPush(e); cap(); } return true; } if (index < 0 || index > size) { throw new IndexOutOfBoundsException(); } throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list"); }
this.boundListOperations.rightPush(value);