admin管理员组文章数量:1307691
I need to migrate from Redis to Oracle Coherence and looking for the best way to replicate Redis's RScoredSortedSet
functionality. Take a look at the below code:
private RScoredSortedSet<Long> getScoredSet(String key) {
RScoredSortedSet<Long> rssSet = redissonClient.getScoredSortedSet(key);
if(!rssSet.isExists()) {
RLock lock = redissonClient.getLock("lockKey");
if(lock.tryLock(1, 20, TimeUnit.SECONDS)) {
try {
rssSet.clear();
// Add score-value pairs
rssSet.add(score, value);
} finally {
lock.unlock();
}
}
}
return rssSet;
}
My Question:
- What’s the best way to simulate a scored sorted set in Coherence (i.e. storing elements with scores and maintaining order, Support for operations like clear() and add(score, value))?
- How can I implement distributed locking in Coherence similar to the use of RLock in Redisson?
I'm new to Coherence and Any guidance on how to achieve this in Coherence would be much appreciated.
本文标签:
版权声明:本文标题:java - How do I replicate Redisson’s RScoredSortedSet behavior in Oracle Coherence - Equivalent Implementation - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741846054a2400784.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论