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

Redis read all values for all hashes

$
0
0

I use this method for Reading all values from Redis, but I am not sure if this is good way:

public List<Value> findAll() {        Set<String> allAvailableKeys = redisTemplate.keys("*");        List<Value> valuesList = new ArrayList<Value>();        Iterator<String> itr = allAvailableKeys.iterator();        while (itr.hasNext()) {            String id = itr.next();            try {                Value value = (Value) hashOperations.get(id, id);                valuesList.add(value);            } catch (NoSuchElementException e) {                // cache could expire in meantime            }        }        return valuesList;

Viewing all articles
Browse latest Browse all 2222


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