Example usage for org.springframework.data.redis.support.collections RedisMap put

List of usage examples for org.springframework.data.redis.support.collections RedisMap put

Introduction

In this page you can find the example usage for org.springframework.data.redis.support.collections RedisMap put.

Prototype

V put(K key, V value);

Source Link

Document

Associates the specified value with the specified key in this map (optional operation).

Usage

From source file:org.springframework.integration.redis.outbound.RedisCollectionPopulatingMessageHandler.java

@SuppressWarnings("unchecked")
private void handleMap(final RedisMap<Object, Object> map, Message<?> message) {
    final Object payload = message.getPayload();
    if (this.extractPayloadElements && payload instanceof Map<?, ?>) {
        this.processInPipeline(new PipelineCallback() {
            public void process() {
                map.putAll((Map<? extends Object, ? extends Object>) payload);
            }/* ww  w.  j  av  a2 s. com*/
        });
    } else {
        Object key = this.assertMapEntry(message, false);
        map.put(key, payload);
    }
}

From source file:org.springframework.integration.redis.outbound.RedisStoreWritingMessageHandler.java

@SuppressWarnings("unchecked")
private void writeToMap(final RedisMap<Object, Object> map, Message<?> message) {
    final Object payload = message.getPayload();
    if (this.extractPayloadElements && payload instanceof Map<?, ?>) {
        this.processInPipeline(new PipelineCallback() {
            public void process() {
                map.putAll((Map<? extends Object, ? extends Object>) payload);
            }//from  w  ww  .  j  av  a2s  .  c  o  m
        });
    } else {
        Object key = this.determineMapKey(message, false);
        map.put(key, payload);
    }
}