@Override
    public void put(String key, Object value, long ttl) {
        withMap(map -> {
            try {
                final String raw;
                if (isNull(value)) {
                    raw = null;
                } else if (value.getClass().isPrimitive() || value instanceof String) {
                    raw = value.toString();
                } else {
                    raw = JSON_MAPPER.writeValueAsString(value);
                }
                map.put(key, raw, ttl, TimeUnit.SECONDS);

            } catch (JsonProcessingException e) {
                throw new RuntimeException(String.format("Error setting value for key '%s'", key), e);
            }
        });
    }
Pass an {@link RMap} to the consumer.

@param consumer the consumer of the {@link RMap}
gateway/engine/redis/src/main/java/io/apiman/gateway/engine/redis/common/RedisBackingStore.java