Replies: 1 comment
-
I'm going with the following setup:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Nodes can have many relations and relations have two nodes. Cyclic references like "node A has relation B, which starts at node A, which has relation B, ..." can be a huge problem for the garbage collector.
Idea: Instead of referencing the nodes/relations directly, they could be referenced through WeakReferences. Once one of the referenced objects is no longer used, it gets automatically removed by the garbage collector.
New property types
NodeReference
: A class which contains a singleWeakReference
. Makes sure that only nodes can be referenced.Provides a way to access the referenced node.
Will be used inside the
Relation
-type for start- & end-node reference.RelationReference
: A class which contains a singleWeakReference
. Makes sure that only relations can be referenced.Provides a way to access the referenced relation.
RelationReferenceStorage
: A class extendingSplObjectStorage
, which can store multipleRelationReference
.Will be used inside the
Node
-type for referencing all relations.Possible problems
Not a problem in this library, because this should be handled in an entity manager (part of another, currently not existing library).
Though the documentation should contain explicit warnings.
Notes
SplObjectStorage
. Though it is a) final, therefore can not be extended. And b) it does not have agetHash()
method like SplObjectStorage.Beta Was this translation helpful? Give feedback.
All reactions