CacheManager
Constructor
constructor
constructor(directory :string): CacheManager
CacheManager is abstract and cannot be instantiated
Parameters:
Name | Type | Required | Description |
---|---|---|---|
directory | string | Yes | The cache directory |
Methods
getLastPublishDate
async getLastPublishDate(siteId: int, options: CacheOptions): Promise<Date|null>
Parameters:
Name | Type | Required | Description |
---|---|---|---|
siteId | int | Yes | |
options | CacheOptions | Yes |
Returns:
The last published date retrived from the API. It is null if the Published / Draft feature is not enabled.
Type: Promise<Date|null>
needsUpdate
async needsUpdate(siteId: int, options: CacheOptions): Promise<{needsUpdate: true, lastPublishedDate: Date|null, hasCache: boolean, hasInternetConnexion: boolean, lastCacheUpdateDate: null|Date}, Error>)
Parameters:
Name | Type | Required | Description |
---|---|---|---|
siteId | int | Yes | |
options | CacheOptions | Yes |
Returns:
Type: Promise<object, Error>
Find bellow the details of the properties
Name | Type | Description |
---|---|---|
needsUpdate | boolean | |
lastPublishedDate | Date | null | |
hasCache | boolean | |
hasInternetConnexion | boolean | |
lastCacheUpdateDate | boolean |
update
async update(siteId: int, options: CacheOptions): Promise<boolean, Error>)
Parameters:
Name | Type | Required | Description |
---|---|---|---|
siteId | int | Yes | |
options | CacheOptions | Yes |
Returns:
Returns true if succeed, otherwise false if there is an outdated cache that can be used.
Reject if there is no cache and the cache manager was unable to update.
Type: Promise<boolean, Error>