localstorage-cache
Saves raw data in localStorage.
localStorage( baseConnection )
Creates a cache of instances and a cache of sets of instances that is accessible to read via getSets, getData, and getListData. The caches are updated via createData, updateData, destroyData, and updateListData.
createData, updateData, destroyData are able to move items in and out of sets.
Use
data/localstorage-cache
is often used with a caching strategy like fall-through-cache or
cache-requests. Make sure you configure the connection's name.
var cacheConnection = connect([
require("can-connect/data/localstorage-cache/localstorage-cache")
],{
name: "todos"
});
var todoConnection = connect([
require("can-connect/data/url/url"),
require("can-connect/fall-through-cache/fall-through-cache")
],
{
url: "/services/todos",
cacheConnection: cacheConnection
});