Open pmaselkowski opened 8 years ago
Possibly this could be done with WeakMap.
So that found instance could be added to WeakSet (by id or class+id), then reused without querying DB.
When updating this object should be removed from WeakMap - and then re-fetched when needed. Problems:
Cache behavior could be affected by annotation, as sometimes this behavior is acceptable.
Possible annotations syntax:
@DbRef(MyClass, cached = true)
Best way to implement this would be through plugins. So updateable feature could be also refactored as plugin.
updateable
Possibly this could be done with WeakMap.
So that found instance could be added to WeakSet (by id or class+id), then reused without querying DB.
When updating this object should be removed from WeakMap - and then re-fetched when needed. Problems:
Cache behavior could be affected by annotation, as sometimes this behavior is acceptable.
Possible annotations syntax:
Best way to implement this would be through plugins. So
updateable
feature could be also refactored as plugin.