12
0

tab_cache #173

Zusammengeführt
Lixfel hat 4 Commits von tab_cache nach master 2022-02-24 21:16:40 +01:00 zusammengeführt
Nur Änderungen aus Commit e807bfc793 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -450,8 +450,10 @@ public class SchematicNode {
if (sws) { if (sws) {
s = s.substring(1); s = s.substring(1);
} }
if(TAB_CACHE.containsKey(user.getId()) && TAB_CACHE.get(user.getId()).containsKey(s)) { int index = s.lastIndexOf("/");
return new ArrayList<>(TAB_CACHE.get(user.getId()).get(s)); String cacheKey = index == -1 ? "" : s.substring(0, index);
if(TAB_CACHE.containsKey(user.getId()) && TAB_CACHE.get(user.getId()).containsKey(cacheKey)) {
return new ArrayList<>(TAB_CACHE.get(user.getId()).get(cacheKey));
} }
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
if (s.contains("/")) { if (s.contains("/")) {
@ -465,7 +467,7 @@ public class SchematicNode {
nodes.forEach(node -> list.add((sws ? "/" : "") + node.getName() + (node.isDir() ? "/" : ""))); nodes.forEach(node -> list.add((sws ? "/" : "") + node.getName() + (node.isDir() ? "/" : "")));
} }
list.remove("//copy"); list.remove("//copy");
Objects.requireNonNull(TAB_CACHE.putIfAbsent(user.getId(), new HashMap<>())).putIfAbsent(s, list); Objects.requireNonNull(TAB_CACHE.putIfAbsent(user.getId(), new HashMap<>())).putIfAbsent(cacheKey, list);
return list; return list;
} }