Actually evict/invalidate nodes when invalidating child nodes via id/accessname,
if they are present in the cache. Fixes bug 190, http://helma.org/bugs/show_bug.cgi?id=190
This commit is contained in:
parent
63bcb750a3
commit
f6b2909aad
3 changed files with 23 additions and 5 deletions
|
@ -435,9 +435,9 @@ public final class Node implements INode, Serializable {
|
|||
Relation rel = getDbMapping ().getSubnodeRelation ();
|
||||
if (rel != null) {
|
||||
if (rel.usesPrimaryKey()) {
|
||||
nmgr.evictKey (new DbKey (getDbMapping().getSubnodeMapping(), key));
|
||||
nmgr.evictNodeByKey (new DbKey (getDbMapping().getSubnodeMapping(), key));
|
||||
} else {
|
||||
nmgr.evictKey (new SyntheticKey (getKey(), key));
|
||||
nmgr.evictNodeByKey (new SyntheticKey (getKey(), key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,8 +360,8 @@ public final class NodeManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove a node from the node cache. If at a later time it is accessed again, it will be
|
||||
* refetched from the database.
|
||||
* Remove a node from the node cache. If at a later time it is accessed again,
|
||||
* it will be refetched from the database.
|
||||
*/
|
||||
public void evictNode (Node node) {
|
||||
node.setState (INode.INVALID);
|
||||
|
@ -369,7 +369,21 @@ public final class NodeManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when a key stops being valid for a node.
|
||||
* Remove a node from the node cache. If at a later time it is accessed again,
|
||||
* it will be refetched from the database.
|
||||
*/
|
||||
public void evictNodeByKey (Key key) {
|
||||
Node n = (Node) cache.remove (key);
|
||||
if (n != null) {
|
||||
n.setState (INode.INVALID);
|
||||
if (!(key instanceof DbKey))
|
||||
cache.remove (n.getKey ());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a key stops being valid for a node. The cached node itself
|
||||
* remains valid, if it is present in the cache by other keys.
|
||||
*/
|
||||
public void evictKey (Key key) {
|
||||
cache.remove (key);
|
||||
|
|
|
@ -110,6 +110,10 @@ import java.util.Vector;
|
|||
nmgr.evictNode (node);
|
||||
}
|
||||
|
||||
public void evictNodeByKey (Key key) {
|
||||
nmgr.evictNodeByKey (key);
|
||||
}
|
||||
|
||||
public void evictKey (Key key) {
|
||||
nmgr.evictKey (key);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue