API Docs for: 0.2.1
Show:

ServiceCacheMixin Class

A Mixin class for caching JSON API resource objects

Methods

cacheControl

(
  • resource
  • headers
)

Store meta from headers on resource meta, window.fetch includes a headers object in the response use headers.get to lookup data from the headers for cache-control, date, and etag.

Parameters:

cacheData

(
  • resp
)

Store resource objects in the data array of the cache

Parameters:

  • resp Object

    w/ props: {Object} meta, {Array|Object} data, & {Object} headers

cacheLookup

(
  • id
)
Resource | Undefined

Lookup a resource from cached data

Parameters:

  • id String

Returns:

Resource | Undefined:

cacheMeta

(
  • resp
)

Store meta data in the cache

Parameters:

  • resp Object

    w/ props: {Object} meta, {Array|Object} data, & {Object} headers

cacheRemove

(
  • resource
)

Remove a resource from cached data

Parameters:

cacheResource

(
  • resp
)

Store response object(s) in the cache

Parameters:

  • resp Object

    w/ props: {Object} meta, {Array|Object} data, & {Object} headers

cacheUpdate

(
  • resp
)

Add or update cache data

Parameters:

  • resp Object

    w/ props: {Object} meta, {Array|Object} data, & {Object} headers

initCache

()

Initialize a cache object

Properties

cache

Object

Cache object