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

Feature/public interface updates #82

Conversation

justinmakaila
Copy link
Contributor

Renamed and exposed the InMemoryCache. It's much easier to set up mock ApolloClient instances for testing without duplicating, and also could be useful for feeding in data.

@martijnwalraven
Copy link
Contributor

martijnwalraven commented Apr 14, 2017

I realize Objective-C has predisposed me to long descriptive names, so InMemoryNormalizedCache sounds perfectly fine to me :) @kompfner also mentioned he thought the name could be shortened, so maybe I'm in the minority here.

My concern is that we may want to add other types of caches in the future. So Apollo Android has a response cache in addition to a normalized cache for example, and they do use the NormalizedCache suffix for their memory and SQL caches.

@justinmakaila
Copy link
Contributor Author

@martijnwalraven I'm into descriptive names as well, I just figured with the existence of the NormalizedCache protocol, and the conformance of InMemory[Normalized]Cache to the protocol, that dropping the Normalized part would be cool.

Could you explain what the response cache is used for? I was under the impression that a NormalizedCache was just a protocol to be implemented, and that any "new" caches would be implemented as dependencies (i.e. how I built Lunar to cache records in CoreData).

@martijnwalraven
Copy link
Contributor

@justinmakaila: The idea of a response cache is to cache individual responses as opposed to normalized records. So you don't get any of the data sharing and consistency benefits, but it might be more efficient to cache complete responses without normalizing them. On Android, a use case that came up is downloading large blobs of data in the background for example.

I think the NormalizedCache should definitely be the focal point of our efforts, and that is where the interesting cache implementations like SQLite and Core Data come in. A response cache is more likely to just write to disk.

@designatednerd
Copy link
Contributor

I'm going to close this based on a combination of @martijnwalraven's response and the lack of activity here for quite a while. We've definitely got some thinking to do about how we're handling caching, I've got a few ideas but nothing I want to put out quite yet.

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

Successfully merging this pull request may close these issues.

3 participants