Skip to content Skip to sidebar Skip to footer

Can Meteor's Appcache Also Store Database Data?

With the latest Meteor version 0.5.9 I've been experimenting with the appcache package, and really like its functionality. I used meteor create --example leaderboard and then meteo

Solution 1:

Look at the Ground:DB Package for this use. This package makes client side caches of subscribed collections.

https://atmospherejs.com/ground/db

Example of a collection that will get populated by Meteor subscriptions (subscribe call required separately)

localCollection = new Ground.Collection('mongoName');

Example of disconnected Collection (so you have to populate it yourself)

disconnectedCollection = new Ground.Collection('localName', {connection:null} );

Solution 2:

The appcache package doesn't cache your data. See the docs:

The appcache package stores the static parts of a Meteor application (the client side Javascript, HTML, CSS, and images) in the browser's application cache.

[...]

(Note however that the appcache package by itself doesn't make data available offline: in an application loaded offline, a Meteor Collection will appear to be empty in the client until the Internet becomes available and the browser is able to establish a livedata connection).

At this point the appcache package is purely meant to improve loading speed of your app by caching static resources. See the meteor wiki:

The appcache package is only designed to cache static resources. As an "application" cache, it caches the resources needed by the application, including the HTML, CSS, Javascript and files published in the public/ directory.

Post a Comment for "Can Meteor's Appcache Also Store Database Data?"