Methods
# inner createCache(storage, options)
Cache wrapper on top of localforage (Used for API calls caching)
Parameters:
| Name | Type | Description |
|---|---|---|
storage |
*
|
|
options |
*
|
# inner get(url)
Retrieve data from cache if key has an expiration time and cache is enabled and cached data is not expired
Parameters:
| Name | Type | Description |
|---|---|---|
url |
*
|
# inner getCacheTime(times, key)
Get cache time value from object Supports retrieving value by matching a key who contains a wildcard
Parameters:
| Name | Type | Description |
|---|---|---|
times |
*
|
|
key |
*
|
Example
{
"/v2/temps_reel/by_vehicule**":"1000"
}
getCacheTime(times, "/v2/temps_reel/by_vehicule?vehicule_id=3125")
//Will return 1000
# inner getCacheTimes()
Retrieves cache times per key (normalized)
# inner set(key, value)
Store data if the key has an expiration time and cache is enabled
Parameters:
| Name | Type | Description |
|---|---|---|
key |
*
|
|
value |
*
|
# inner shouldCache(key)
Check if a key has an expiration time and if cache is enabled
Parameters:
| Name | Type | Description |
|---|---|---|
key |
*
|
# inner shouldDisableCache()
Checks if cache should be disabled via an special URL parameter