Skip to content

Commit

Permalink
SAK-31744 fix places where MemoryService cache is improperly used, pl… (
Browse files Browse the repository at this point in the history
sakaiproject#3306)

* SAK-31744 fix places where MemoryService cache is improperly used, plus a few misc cleanups

* SAK-31744: remove TODO comments
  • Loading branch information
mgolden-noodle authored and ottenhoff committed Sep 29, 2016
1 parent 821fd77 commit 734d93f
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 1,881 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2795,13 +2795,16 @@ public Map<String, Set<String>> getHierarchySearchOptions(Map<String, String> hi
for(String k : orderedKeys){
key += k + ";" + (hierarchySearchMap.get(k) == null ? "" : hierarchySearchMap.get(k)) + ";";
}
Map<String, Set<String>> results = null;
if(hierarchySearchCache.containsKey(key)){
return (Map<String, Set<String>>) hierarchySearchCache.get(key);
}else{
Map<String, Set<String>> results = dao.getHierarchySearchOptions(hierarchySearchMap);
hierarchySearchCache.put(key, results);
return results;
results = (Map<String, Set<String>>) hierarchySearchCache.get(key);
if(results != null) {
return results;
}
}
results = dao.getHierarchySearchOptions(hierarchySearchMap);
hierarchySearchCache.put(key, results);
return results;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3059,7 +3059,8 @@ public Set<String> getMaintainRoles(){

if (maintainRolesCache != null && maintainRolesCache.containsKey("maintainRoles")) {
maintainRoles = (Set<String>) maintainRolesCache.get("maintainRoles");
} else {
}
if(maintainRoles == null) {
String sql = dbAuthzGroupSql.getMaintainRolesSql();
maintainRoles = new HashSet<String>(m_sql.dbRead(sql));
maintainRolesCache.put("maintainRoles", maintainRoles);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ public void put(String key, Object payload)
/**
* Test for a non expired entry in the cache.
*
* 2016-09-07 - Mitch Golden - The key may in fact be expired!
* Be careful if you use this method
*
* @param key
* The cache key.
* @return true if the key maps to a non-expired cache entry, false if not.
* @return true if the key maps to a cache entry, false if not.
*/
@Override
public boolean containsKey(String key)
Expand Down
Loading

0 comments on commit 734d93f

Please sign in to comment.