Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache DBRefs/Related #69

Open
pmaselkowski opened this issue Apr 8, 2016 · 0 comments
Open

Cache DBRefs/Related #69

pmaselkowski opened this issue Apr 8, 2016 · 0 comments
Labels

Comments

@pmaselkowski
Copy link
Member

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:

  1. When doing mass-updates by criteria - no way to detect which were updated
  2. Require additional extension - this could be remedied by optionality mentioned below

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant