cache-model

Methods

(static) check(survey) → {Promise.<(Error|null|boolean)>}

Source:

Checks if cache is present and up to date

Parameters:
Name Type Description
survey module:survey-model~SurveyObject

survey object

Returns:

a Promise that resolves with a boolean

Type
Promise.<(Error|null|boolean)>

(static) flush(survey) → {Promise.<(Error|module:survey-model~SurveyObject)>}

Source:

Flushes the cache of a single survey

Parameters:
Name Type Description
survey module:survey-model~SurveyObject

survey object

Returns:

Flushed SurveyObject

Type
Promise.<(Error|module:survey-model~SurveyObject)>

(static) flushAll() → {Promise.<(Error|boolean)>}

Source:

Completely empties the cache

Returns:

Promise that resolves true after all cache is flushed

Type
Promise.<(Error|boolean)>

(static) get(survey) → {Promise.<(Error|null|module:survey-model~SurveyObject)>}

Source:

Gets an item from the cache.

Parameters:
Name Type Description
survey module:survey-model~SurveyObject

survey object

Returns:

Promise that resolves with cached SurveyObject or null

Type
Promise.<(Error|null|module:survey-model~SurveyObject)>

(static) getHashes(survey) → {Promise.<(Error|module:survey-model~SurveyObject)>}

Source:

Gets the hashes of an item from the cache.

Parameters:
Name Type Description
survey module:survey-model~SurveyObject

survey object

Returns:

Promise that resolves with SurveyObject (updated with hash array if such exist)

Type
Promise.<(Error|module:survey-model~SurveyObject)>

(static) set(survey) → {Promise.<(Error|module:survey-model~SurveyObject)>}

Source:

Adds an item to the cache

Parameters:
Name Type Description
survey module:survey-model~SurveyObject

survey object

Returns:

a Promise that resolves with the survey object

Type
Promise.<(Error|module:survey-model~SurveyObject)>

(inner) _addHashes(survey)

Source:

Adds the 3 relevant hashes to the survey object if they haven't been added already.

Parameters:
Name Type Description
survey module:survey-model~SurveyObject

survey object

(inner) _getKey(survey) → {string|null}

Source:

Gets the key used for the cache item

Parameters:
Name Type Description
survey module:survey-model~SurveyObject

survey object

Returns:

openRosaKey or null

Type
string | null

(async, inner) cacheManifestItem(mediaURL, hostURL)

Source:
Parameters:
Name Type Description
mediaURL string
hostURL string