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
Returns:
Type
Promise.<(Error|null|boolean)>

(static) flush(survey) → {Promise.<(Error|SurveyObject)>}

Source:

Flushes the cache of a single survey

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

Flushed SurveyObject

Type
Promise.<(Error|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|SurveyObject)>}

Source:

Gets an item from the cache.

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

Promise that resolves with cached SurveyObject or null

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

(static) getHashes(survey) → {Promise.<(Error|SurveyObject)>}

Source:

Gets the hashes of an item from the cache.

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

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

Type
Promise.<(Error|SurveyObject)>

(static) set(survey) → {Promise.<(Error|SurveyObject)>}

Source:

Adds an item to the cache

Parameters:
Name Type Description
survey module:survey-model~SurveyObject
Returns:
Type
Promise.<(Error|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

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

Source:

Gets the key used for the cache item

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

openRosaKey or null

Type
string | null