-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for bounded Redisson map cache (max size configuration). #985
Conversation
final int maxSize = 2; | ||
Map<String, String> store = new LinkedHashMap<String, String>() { | ||
@Override | ||
protected boolean removeEldestEntry(Entry<String, String> eldest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required as store represents an onheap cache, not the cache in redis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnou Great contribution. Please consider my comments, before I merge
" end;" + | ||
" end;" + | ||
"end;" + | ||
"return map;", | ||
Arrays.<Object>asList(getName(), getTimeoutSetName(), getIdleSetName()), args.toArray()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnou getLastAccessTimeSetName() is missed
+ "return 0; " | ||
+ "end", | ||
Arrays.<Object>asList(getName(key), getTimeoutSetNameByKey(key), getIdleSetNameByKey(key), getRemovedChannelNameByKey(key), | ||
getLastAccessTimeSetName()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnou getLastAccessTimeSetNameByKey should be used instead
+ "return val;" | ||
+ "end; ", | ||
Arrays.<Object>asList(getName(key), getTimeoutSetNameByKey(key), getIdleSetNameByKey(key), getCreatedChannelNameByKey(key), | ||
getLastAccessTimeSetName(), getRemovedChannelName()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnou getLastAccessTimeSetNameByKey, getRemovedChannelNameByKey should be used instead
+ "end; ", | ||
Arrays.<Object>asList(getName(key), getTimeoutSetNameByKey(key), getIdleSetNameByKey(key), getCreatedChannelNameByKey(key)), | ||
System.currentTimeMillis(), ttlTimeout, maxIdleTimeout, maxIdleDelta, encodeMapKey(key), encodeMapValue(value)); | ||
"local insertable = false; " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnou please format this lua-script properly
+ "if t ~= 0 then " | ||
+ "local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); " | ||
+ "if expireIdle ~= false then " | ||
"local v = redis.call('hget', KEYS[1], ARGV[2]); " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnou please format this lua-script properly
|
||
+ "return val; ", | ||
Arrays.<Object>asList(getName(key), getTimeoutSetNameByKey(key), getIdleSetNameByKey(key), getUpdatedChannelNameByKey(key)), | ||
"local value = redis.call('hget', KEYS[1], ARGV[2]); " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnou please format this lua-script properly
edb4e9b
to
8e906ba
Compare
@mrniko PTAL |
Currently RedissonMapCache creates an unbounded set in Redis which may cause problems in certain cache implementations.
Thanks for the heavy lifting @zuanoc !