LokiDataAdapter
このコンテンツはまだ日本語訳がありません。
Defined in: extras/LokiDataAdapter.ts:45
Cache database using LokiJS
- Requires lokijs
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LokiDataAdapter(
options?
):LokiDataAdapter
Defined in: extras/LokiDataAdapter.ts:59
Parameters
Section titled “Parameters”options?
Section titled “options?”LokiDataAdapterOptions
Returns
Section titled “Returns”LokiDataAdapter
Properties
Section titled “Properties”autosave
Section titled “autosave”autosave:
boolean
Defined in: extras/LokiDataAdapter.ts:49
autosaveInterval
Section titled “autosaveInterval”autosaveInterval:
number
Defined in: extras/LokiDataAdapter.ts:50
db:
LokiConstructor
Defined in: extras/LokiDataAdapter.ts:56
dbDir:
string
Defined in: extras/LokiDataAdapter.ts:47
dbFile
Section titled “dbFile”dbFile:
string
Defined in: extras/LokiDataAdapter.ts:46
dbPath
Section titled “dbPath”dbPath:
string
=":memory:"
Defined in: extras/LokiDataAdapter.ts:54
files:
Collection
<ImgProcFileRecord
>
Defined in: extras/LokiDataAdapter.ts:57
isInMemory
Section titled “isInMemory”isInMemory:
boolean
Defined in: extras/LokiDataAdapter.ts:48
retentionCount
Section titled “retentionCount”retentionCount:
null
|number
Defined in: extras/LokiDataAdapter.ts:53
retentionPeriod
Section titled “retentionPeriod”retentionPeriod:
null
|number
=10
Defined in: extras/LokiDataAdapter.ts:52
Methods
Section titled “Methods”close()
Section titled “close()”close():
void
Defined in: extras/LokiDataAdapter.ts:268
Save and close database
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”countdown()
Section titled “countdown()”countdown():
void
Defined in: extras/LokiDataAdapter.ts:226
Countdown all records
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”delete()
Section titled “delete()”delete(
criteria
):void
Defined in: extras/LokiDataAdapter.ts:203
Delete the record
Parameters
Section titled “Parameters”criteria
Section titled “criteria”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”deleteExpiredRecords()
Section titled “deleteExpiredRecords()”deleteExpiredRecords(
now
):null
|Set
<string
>
Defined in: extras/LokiDataAdapter.ts:240
Delete expired records
Parameters
Section titled “Parameters”number
= ...
Unixtime (milliseconds)
Returns
Section titled “Returns”null
| Set
<string
>
Deleted hashes or null
Implementation of
Section titled “Implementation of”ImgProcDataAdapter
.deleteExpiredRecords
fetch()
Section titled “fetch()”fetch(
criteria
):null
| {b?
:number
;base64?
:string
;category
:ImgProcFileCategory
;countdown
:number
;expiresAt?
:number
;format
:string
;g?
:number
;hash
:string
;height
:number
;lastUsedAt
:number
;profile?
:string
;r?
:number
;source
:string
;width
:number
; }
Defined in: extras/LokiDataAdapter.ts:154
Fetch single record
- To fetch a record with category
source
, specifyhash
. - To fetch a record with category
variant
orplaceholder
, specifysource
andprofile
.
Parameters
Section titled “Parameters”criteria
Section titled “criteria”Returns
Section titled “Returns”null
{ b?
: number
; base64?
: string
; category
: ImgProcFileCategory
; countdown
: number
; expiresAt?
: number
; format
: string
; g?
: number
; hash
: string
; height
: number
; lastUsedAt
: number
; profile?
: string
; r?
: number
; source
: string
; width
: number
; }
optional
b:number
Dominant color based on sharp().stats()
- Updatable
base64?
Section titled “base64?”
optional
base64:string
Base64 for placeholder
category
Section titled “category”category:
ImgProcFileCategory
File category
countdown
Section titled “countdown”countdown:
number
Count to expiration
expiresAt?
Section titled “expiresAt?”
optional
expiresAt:number
Remote image expiration date (unixtime, milliseconds)
- Updatable
- Based on
Cache-Control
orExpires
header. - Equivalent to browser cache.
format
Section titled “format”format:
string
Based on sharp().metadata()
optional
g:number
Dominant color based on sharp().stats()
- Updatable
hash:
string
Hash
- Indexed
- Placeholder:
hasher(base64)
- Remote file:
hasher(src)
- Local file:
hasher(buffer)
orhasher(src)
- Data URL:
hasher(base64)
height
Section titled “height”height:
number
Real height
lastUsedAt
Section titled “lastUsedAt”lastUsedAt:
number
Unixtime of the last used build (ms)
profile?
Section titled “profile?”
optional
profile:string
Only for variant and placeholder
optional
r:number
Dominant color based on sharp().stats()
- Updatable
source
Section titled “source”source:
string
Source hash
- Indexed
- Variant/Placeholder: Source hash
- Source/Local file: Last used
src
attribute - Source/Remote file: Last used downloaded URL
- Source/Data URL: Fixed string “data”
width:
number
Real width
Implementation of
Section titled “Implementation of”initialize()
Section titled “initialize()”initialize(
options
):Promise
<void
>
Defined in: extras/LokiDataAdapter.ts:77
Async part of constructor
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise
<void
>
Implementation of
Section titled “Implementation of”insert()
Section titled “insert()”insert(
data
):void
Defined in: extras/LokiDataAdapter.ts:175
Insert the record
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”list()
Section titled “list()”list():
Set
<string
>
Defined in: extras/LokiDataAdapter.ts:166
List all hashes
Returns
Section titled “Returns”Set
<string
>
Implementation of
Section titled “Implementation of”renew()
Section titled “renew()”renew(
criteria
):void
Defined in: extras/LokiDataAdapter.ts:207
Renew the record
Parameters
Section titled “Parameters”criteria
Section titled “criteria”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”updateMetadata()
Section titled “updateMetadata()”updateMetadata(
data
):void
Defined in: extras/LokiDataAdapter.ts:183
Update the record for remote file
Parameters
Section titled “Parameters”number
expiresAt?
Section titled “expiresAt?”number
format
Section titled “format”string
number
string
height
Section titled “height”number
number
number
Returns
Section titled “Returns”void