Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

privatize SQLiteCache - #3454

Merged
jfirebaugh merged 1 commit into
masterfrom
private-cache
Jan 8, 2016
Merged

jfirebaugh merged 1 commit into
masterfrom
private-cache

Conversation

@jfirebaugh

Copy link
Copy Markdown
Contributor

No code that uses DefaultFileSource wants to not use SQLiteCache. We should make the SQLiteCache instance a member of DefaultFileSource, thus enforcing its use, and remove it and the FileCache base class from the public API.

cc @kkaefer

@tmpsantos

Copy link
Copy Markdown
Contributor

Not sure about this one.

There are use cases like Node that implements its own file source and it is moving towards on using memory backed SQLiteCache for sharing a cache between all the different file sources.

Also we would have to forward interfaces for the cache path and cache size on the DefaultFileSource.

And finally, I would like to experiment with different cache configurations, like stack two SQLiteCache being the first level in-memory and the other in-disk to see if we can get better performance on slow I/O environments.

@kkaefer

kkaefer commented Jan 7, 2016

Copy link
Copy Markdown
Member

I'm also partial on this one; the idea is to cleanly separate caching and file fetching logic. Removal of that separation will also make it harder to test these components, e.g. because we can no longer replace the cache with a mock object for testing the file source, or test the cache directly.

@tmpsantos The node module uses a separate FileSource altogether, not just another FileCache.

@jfirebaugh

Copy link
Copy Markdown
Contributor Author

idea is to cleanly separate caching and file fetching logic

We now have a separate OnlineFileSource class. I think the right separation is to have OnlineFileSource responsible for the fetching logic, with no caching or offline logic, an OfflineFileSource which is responsible for caching / offline, and DefaultFileSource responsible for coordinating one of each. The only public class is DefaultFileSource. It would expose the public core API for caching / offline to the SDK bindings.

@jfirebaugh

Copy link
Copy Markdown
Contributor Author

👀 @kkaefer @tmpsantos

Despite all the architecture discussion above, I actually had a very simple change in mind to start out with. WDYT?

@tmpsantos

Copy link
Copy Markdown
Contributor

Despite all the architecture discussion above, I actually had a very simple change in mind to start out with. WDYT?

Looks good to me but we should handle something like empty path not creating a cache.

@jfirebaugh

Copy link
Copy Markdown
Contributor Author

@tmpsantos Do we need that feature anywhere? If not, let's leave it out.

@tmpsantos

Copy link
Copy Markdown
Contributor

@tmpsantos Do we need that feature anywhere? If not, let's leave it out.

Not that I'm aware of.

@jfirebaugh
jfirebaugh merged commit e7b0b31 into master Jan 8, 2016
@jfirebaugh
jfirebaugh deleted the private-cache branch January 8, 2016 20:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants