JsonFileDataAdapter
Cache database using JSON file
Implements
Constructors
new JsonFileDataAdapter()
new JsonFileDataAdapter(
options
?):JsonFileDataAdapter
Parameters
• options?: JsonFileDataAdapterOptions
Returns
Defined in
src/extras/JsonFileDataAdapter.ts:53
Properties
dbDir
dbDir:
string
Defined in
src/extras/JsonFileDataAdapter.ts:39
dbFile
dbFile:
string
Defined in
src/extras/JsonFileDataAdapter.ts:38
dbPath
dbPath:
string
=":memory:"
Defined in
src/extras/JsonFileDataAdapter.ts:45
debounce
debounce:
number
Defined in
src/extras/JsonFileDataAdapter.ts:41
files
files:
ImgProcFileRecord
[] =[]
Defined in
src/extras/JsonFileDataAdapter.ts:47
isInMemory
isInMemory:
boolean
Defined in
src/extras/JsonFileDataAdapter.ts:40
retentionCount
retentionCount:
null
|number
Defined in
src/extras/JsonFileDataAdapter.ts:44
retentionPeriod
retentionPeriod:
null
|number
=10
Defined in
src/extras/JsonFileDataAdapter.ts:43
Methods
close()
close():
void
Close database
Returns
void
Implementation of
Defined in
src/extras/JsonFileDataAdapter.ts:223
countdown()
countdown():
void
Countdown all records
Returns
void
Implementation of
Defined in
src/extras/JsonFileDataAdapter.ts:184
delete()
delete(
criteria
):void
Delete the record
Parameters
• criteria: ImgProcDataAdapterCriteria
Returns
void
Implementation of
Defined in
src/extras/JsonFileDataAdapter.ts:152
deleteExpiredRecords()
deleteExpiredRecords(
now
):null
|Set
<string
>
Delete expired records
Parameters
• now: number
= ...
Unixtime (milliseconds)
Returns
null
| Set
<string
>
Deleted hashes or null
Implementation of
ImgProcDataAdapter
.deleteExpiredRecords
Defined in
src/extras/JsonFileDataAdapter.ts:197
fetch()
fetch(
criteria
):null
|ImgProcFileRecord
Fetch single record
- To fetch a record with category
source
, specifyhash
. - To fetch a record with category
variant
orplaceholder
, specifysource
andprofile
.
Parameters
• criteria: ImgProcDataAdapterCriteria
Returns
null
| ImgProcFileRecord
Implementation of
Defined in
src/extras/JsonFileDataAdapter.ts:108
initialize()
initialize(
options
):void
Initialize database
Parameters
• options: ImgProcDataAdapterInitOptions
Returns
void
Implementation of
Defined in
src/extras/JsonFileDataAdapter.ts:66
insert()
insert(
data
):void
Insert the record
Parameters
• data: ImgProcFile
Returns
void
Implementation of
Defined in
src/extras/JsonFileDataAdapter.ts:122
list()
list():
Set
<string
>
List all hashes
Returns
Set
<string
>
Implementation of
Defined in
src/extras/JsonFileDataAdapter.ts:118
renew()
renew(
criteria
):void
Renew the record
Parameters
• criteria: ImgProcDataAdapterCriteria
Returns
void
Implementation of
Defined in
src/extras/JsonFileDataAdapter.ts:164
updateMetadata()
updateMetadata(
data
):void
Update the record for remote file
Parameters
• data
• data.b?: number
• data.expiresAt?: number
• data.format: string
• data.g?: number
• data.hash: string
• data.height: number
• data.r?: number
• data.width: number
Returns
void
Implementation of
ImgProcDataAdapter
.updateMetadata