]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeCache.java
Update structure and value cache when refreshing variable
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / NodeCache.java
index 309efe31e21efa9f3ffb02ef9db223c924d64e83..5ed9678e9ec41aa4d75f6375b09362a1844f83a1 100644 (file)
@@ -116,6 +116,24 @@ public class NodeCache<Node,Value> {
                scheduleExpiration(node, System.nanoTime() + defaultExpirationTimeInNs);
        }
 
                scheduleExpiration(node, System.nanoTime() + defaultExpirationTimeInNs);
        }
 
+       public synchronized void remove(Node node) {
+               if (disposed)
+                       return;
+               Long expTime = exp.get(node);
+               if (expTime != null) {
+                       expirationTimes.remove(expTime);
+               }
+               map.remove(node);
+       }
+
+       public synchronized void clear() {
+               if (disposed)
+                       return;
+               expirationTimes.clear();
+               exp.clear();
+               map.clear();
+       }
+
        public synchronized void dispose() {
                disposed = true;
                expirationTimes.clear();
        public synchronized void dispose() {
                disposed = true;
                expirationTimes.clear();