[
https://issues.apache.org/jira/browse/IGNITE-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vyacheslav Daradur updated IGNITE-4823:
---------------------------------------
Description:
*Current implementation:*
{code}
Object old;
if (val == null)
old = cache.withSkipStore().putIfAbsent(key, NULL);
else
old = cache.putIfAbsent(key, val);
return old != null ? fromValue(old) : null;
{code}
cache.putIfAbsent(key, val) - return boolean, not cached value
*Excepted behavior (according to the Spring-docs)*
{code}
Object existingValue = cache.get(key);
if (existingValue == null) {
cache.put(key, value);
return null;
} else {
return existingValue;
}
{code}
1. Need to fix implementation
2. Cover SpringCache class with unit-tests
was:
Current implementation:
{code}
Object old;
if (val == null)
old = cache.withSkipStore().putIfAbsent(key, NULL);
else
old = cache.putIfAbsent(key, val);
return old != null ? fromValue(old) : null;
{code}
cache.putIfAbsent(key, val) - return boolean, not cached value
*Excepted behavior (according to the Spring-docs)*
{code}
Object existingValue = cache.get(key);
if (existingValue == null) {
cache.put(key, value);
return null;
} else {
return existingValue;
}
{code}
1. Need to fix implementation
2. Cover SpringCache class with unit-tests
> SpringCache#putIfAbsent - wrong implementation
> ----------------------------------------------
>
> Key: IGNITE-4823
> URL: https://issues.apache.org/jira/browse/IGNITE-4823
> Project: Ignite
> Issue Type: Bug
> Components: cache
> Reporter: Vyacheslav Daradur
> Assignee: Vyacheslav Daradur
>
> *Current implementation:*
> {code}
> Object old;
> if (val == null)
> old = cache.withSkipStore().putIfAbsent(key, NULL);
> else
> old = cache.putIfAbsent(key, val);
> return old != null ? fromValue(old) : null;
> {code}
> cache.putIfAbsent(key, val) - return boolean, not cached value
> *Excepted behavior (according to the Spring-docs)*
> {code}
> Object existingValue = cache.get(key);
> if (existingValue == null) {
> cache.put(key, value);
> return null;
> } else {
> return existingValue;
> }
> {code}
> 1. Need to fix implementation
> 2. Cover SpringCache class with unit-tests
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)