datasource-caching.mustache revision 72378c4b11f0468874fbad14749246d2ae564474
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<style scoped>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster/* custom styles for this example */
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster#demo .output {
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster margin-bottom:1em;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster padding:10px;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster border:1px solid #D9D9D9;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster#demo .output pre {
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster font-size: 11px;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster#demo .output strong {
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster padding: .25em .4em;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster background: #333;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster color: #fff;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster text-shadow: -1px -1px 1px #000;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster border-radius: 5px;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<div class="intro">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <p>The DataSourceCache plugin enables caching on any DataSource to reduce high-latency calls to remote sources and to reduce server load. In this example, the Cache's `max` value has been set to `3`.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<div class="example">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster {{>datasource-caching-source}}
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<p>Use the <code>plug()</code> method to initialize the
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<code>DataSourceCache</code> plugin and pass in the configuration value
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<code>max</code> to set the maximum size.</p>
0a99555401a033704f1f171baab6db11fb5528f2Allan FosterYUI().use("datasource", "dataschema", "cache", function (Y) {
myDataSource = new Y.DataSource.Get({
source: "https://api.github.com/users/",
return '/repos?callback=YUI.Env.DataSource.callbacks.' + guid;