DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
    • can-component
    • can-compute
    • can-connect
      • behaviors
        • ./base/
        • ./cache-requests/
        • ./can/map/
        • ./can/ref/
        • ./constructor/callbacks-once/
        • ./constructor/
        • ./constructor/store/
        • ./data/callbacks/
        • ./data/callbacks-cache/
        • ./data/combine-requests/
        • ./data/localstorage-cache/
        • ./data/memory-cache/
          • data methods
            • clear
            • createData
            • destroyData
            • getData
            • getListData
            • getSets
            • updateData
            • updateListData
        • ./data/parse/
        • ./data/url/
        • ./data/worker/
        • ./fall-through-cache/
        • ./real-time/
      • modules
        • ./can/base-map/
        • ./can/model/
        • ./can/super-map/
        • ./can/tag/
        • ./helpers/weak-reference-map
      • data types
        • DataInterface
        • Instance
        • InstanceInterface
        • List
        • ListData
    • can-define
    • can-define/list/list
    • can-define/map/map
    • can-route
    • can-route-pushstate
    • can-set
    • can-stache
    • can-stache/helpers/route
    • can-stache-bindings
  • Ecosystem
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Core
  • /
  • can-connect
  • /
  • ./data/memory-cache/
  • / On this page
    • can-connect/data/memory-cache/memory-cache

      module

      Saves raw data in JavaScript memory that disappears when the page refreshes.

      • source

      memoryCache( 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/memory-cache is often used with a caching strategy like can-connect/fall-through-cache/fall-through-cache or can-connect/cache-requests/cache-requests.

      var cacheConnection = connect([
        require("can-connect/data/memory-cache/memory-cache")
      ],{});
      
      var todoConnection = connect([
        require("can-connect/data/url/url"),
        require("can-connect/fall-through-cache/fall-through-cache")
      ],
      {
        url: "/services/todos",
        cacheConnection: cacheConnection
      });
      

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.