What would be the best way to ensure that my collection stays cached and thereby only gets fetched once?
Should I implement some sort of cache layer? Should I share the
A simple solution would be to make a global variable for your collection so that all your javascript code will use the same variable.
Just fetch the collection when the page loads
$(function() {
myCollection = theCollection();
myCollection.fetch();
});
Since var is not used to declared myCollection, then it becomes a global variable.
Of course this is a simple implementation. There are more robust implementations, but depending on your needs, they might be overkill.