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

Move caches out of Source and into ember-orbit Store? #91

Closed
opsb opened this issue Feb 12, 2015 · 2 comments
Closed

Move caches out of Source and into ember-orbit Store? #91

opsb opened this issue Feb 12, 2015 · 2 comments

Comments

@opsb
Copy link
Contributor

opsb commented Feb 12, 2015

I've been implementing a Source for Firebase and one of the things that surprised me was that each source maintains it's own cache. As far as I can tell this is to facilitate synchronous access through the retrieve method. Rather than maintaining caches for each individual Source perhaps it would be simpler/more efficient to keep one inside the ember-orbit Store instead? This way the Source implementations don't need to consider the cache at all (less to understand when implementing a Source) and the information isn't duplicated in memory for every Store.

@dgeb
Copy link
Member

dgeb commented Feb 12, 2015

@opsb Very cool to hear about your Firebase source!

As long as retrieve works synchronously on a source, it should not need a cache. I plan to make the cache completely optional on the base Source class.

However, I would not recommend placing a cache at the ember-orbit Store level, which would require that your orbit source only work with ember-orbit and somehow be aware of the associated Store. Its important that retrieve work on the Source level inside Orbit, so that transform connectors can inspect sources to compare their contents and determine which changes are needed. This doesn't mean that each source have a cache - just that retrieve work synchronously (and the easiest way to achieve this initially was to put a cache on each source).

@dgeb dgeb closed this as completed Feb 12, 2015
@opsb
Copy link
Contributor Author

opsb commented Feb 12, 2015

"so that transform connectors can inspect sources to compare their contents and determine which changes are needed. " aha, I did wonder about this, I hadn't figured out how Orbit stopped operations from bouncing backwards and forwards, makes a lot of sense now.

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

No branches or pull requests

2 participants