Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Java Quarkus using Redis as a Cache with UUID keys

$
0
0

Hello i'm having an issue with the java.util.UUID object in a redis cache. I have a cache defined as follows

    private final ValueCommands<UUID, String> commands;    public Cache(RedisDataSource ds) {        this.commands = ds.value(UUID.class, String.class);    }    public String get(UUID key) {        var value = commands.get(key);    }    

This does not work. the get command is unable to find any values with that key.

So my question is, is UUID not supported? Should I always prefer the string key value pair?

    private final ValueCommands<String, String> commands;    public Cache(RedisDataSource ds) {        this.commands = ds.value(String.class, String.class);    }    public String get(String key) {        var value = commands.get(key);    }    

doing it like this works.

I'm testing this by connecting to the redis CLI and inputing a value with

SET 38e8598b-e700-440c-b92f-b2d078d6fb5f "hello"

then calling cache.get and this does not work with UUID as shown above but this work with String


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>