Andrus Adamchik created CAY-1774:
------------------------------------
Summary: EhCacheQueryCache.get(QueryMetadata,
QueryCacheEntryFactory) returns null if EhCache instance for group is not
present
Key: CAY-1774
URL: https://issues.apache.org/jira/browse/CAY-1774
Project: Cayenne
Issue Type: Bug
Components: Core Library
Affects Versions: 3.1B1
Reporter: Andrus Adamchik
Assignee: Andrus Adamchik
Priority: Minor
Fix For: 3.1B2, 3.2M1
Here is a problematic piece of code:
public List get(QueryMetadata metadata, QueryCacheEntryFactory factory) {
String key = metadata.getCacheKey();
if (key == null) {
return null;
}
Ehcache cache = null;
Element result = null;
String[] groupNames = metadata.getCacheGroups();
if (groupNames != null && groupNames.length > 0) {
// SHOULD WE USE 'addCacheIfAbsent' here, as we already have a factory
to populate object???
cache = cacheManager.getCache(groupNames[0]);
if (cache == null) {
return null;
}
....
Also maybe we can refactor calls to 'get' and 'put' within this method to avoid
multiple cache lookups, when we already have a cache instance in place.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira