@SuppressWarnings("unchecked")
    @Override
    public <T> T get(String key, Class<T> type) {
        return onMap(map -> {
            try {
                final String raw = map.get(key);
                if (isNull(raw)) {
                    return null;
                } else if (type.isPrimitive() || type.isAssignableFrom(String.class)) {
                    return (T) BackingStoreUtil.readPrimitive(type, raw);
                } else {
                    return JSON_MAPPER.readValue(raw, type);
                }
            } catch (Exception e) {
                throw new RuntimeException(String.format("Error reading 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