store/Cache

Source:

Methods

addCacheUpdateListener(listener)

Source:
Parameters:
Name Type Description
listener function

addPromise(loadID, loadPromise)

Description:
  • Store the promise for loading something.

Source:
Parameters:
Name Type Description
loadID String
loadPromise Promise

allNeedRefresh()

Description:
  • Marks all entries as in need of refresh and consequently messages all listeners with the allEntriesNeedRefresh topic.

Source:

cache(entry, silentlyopt)

Description:
  • Add or update the entry to the cache. All listeners will be notified unless silently is specified.

Source:
Parameters:
Name Type Attributes Description
entry Entry
silently Boolean <optional>

listeners will be notified unless true is specified.

cacheAll(entryArr, silentlyopt)

Description:
  • A convenience method for caching multiple entries.

Source:
See:
  • Cache#cache
Parameters:
Name Type Attributes Description
entryArr Array.<Entry>
silently Boolean <optional>

clear()

Description:
  • Clears the cache from all cached entries. Warning: all references to entries needs to be discarded as they will not be kept in sync with changes.

Source:

get(entryURI) → {Entry|undefined}

Description:
  • Retrieve the entry from it's URI.

Source:
Parameters:
Name Type Description
entryURI String
Returns:
Type
Entry | undefined

getByResourceURI(uri) → {Set.<Entry>}

Description:
  • Retrieve all entries that have the specified uri as resource. Note that since several entries (e.g. links) may have the same uri as resource this method returns an array. However, in many situations there will be zero or one entry per uri.

Source:
Parameters:
Name Type Description
uri String
Returns:

always returns a set, may be empty though.

Type
Set.<Entry>

getPromise(loadID) → {Promise|undefined}

Description:
  • Retrieve a load promise.

Source:
Parameters:
Name Type Description
loadID String
Returns:
Type
Promise | undefined

messageListeners(topic, affectedEntryopt)

Description:
  • Agreed topics are: allEntriesNeedRefresh - all entries are now in need of refresh, typically happens after a change of user(sign in) needRefresh - the specified entry need to be refreshed. refreshed - the specified entry have been refreshed.

Source:
Parameters:
Name Type Attributes Description
topic String
affectedEntry Entry <optional>

needRefresh(entry) → {boolean}

Description:
  • Tells whether the entry is in need of a refresh from the repository.

Source:
Parameters:
Name Type Description
entry Entry
Returns:
Type
boolean

removeCacheUpdateListener(listener)

Source:
Parameters:
Name Type Description
listener function

removePromise(loadID)

Description:
  • Remove the promise responsible for loading something.

Source:
Parameters:
Name Type Description
loadID String

setRefreshNeeded(entry, silentlyopt)

Description:
  • Marks an entry as in need of refresh from the store. All listeners are notified of the entry now being in need of refreshing unless silently is set to true.

Source:
Parameters:
Name Type Attributes Description
entry Entry
silently Boolean <optional>

unCache(entry)

Description:
  • Removes a single entry from the cache.

Source:
Parameters:
Name Type Description
entry Entry

the entry to remove.