コンテンツにスキップ

LokiDataAdapter

このコンテンツはまだ日本語訳がありません。

Defined in: extras/LokiDataAdapter.ts:45

Cache database using LokiJS

new LokiDataAdapter(options?): LokiDataAdapter

Defined in: extras/LokiDataAdapter.ts:59

LokiDataAdapterOptions

LokiDataAdapter

autosave: boolean

Defined in: extras/LokiDataAdapter.ts:49


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: string

Defined in: extras/LokiDataAdapter.ts:46


dbPath: string = ":memory:"

Defined in: extras/LokiDataAdapter.ts:54


files: Collection<ImgProcFileRecord>

Defined in: extras/LokiDataAdapter.ts:57


isInMemory: boolean

Defined in: extras/LokiDataAdapter.ts:48


retentionCount: null | number

Defined in: extras/LokiDataAdapter.ts:53


retentionPeriod: null | number = 10

Defined in: extras/LokiDataAdapter.ts:52

close(): void

Defined in: extras/LokiDataAdapter.ts:268

Save and close database

void

ImgProcDataAdapter.close


countdown(): void

Defined in: extras/LokiDataAdapter.ts:226

Countdown all records

void

ImgProcDataAdapter.countdown


delete(criteria): void

Defined in: extras/LokiDataAdapter.ts:203

Delete the record

ImgProcDataAdapterCriteria

void

ImgProcDataAdapter.delete


deleteExpiredRecords(now): null | Set<string>

Defined in: extras/LokiDataAdapter.ts:240

Delete expired records

number = ...

Unixtime (milliseconds)

null | Set<string>

Deleted hashes or null

ImgProcDataAdapter.deleteExpiredRecords


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, specify hash.
  • To fetch a record with category variant or placeholder, specify source and profile.

ImgProcDataAdapterCriteria

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

optional base64: string

Base64 for placeholder

category: ImgProcFileCategory

File category

countdown: number

Count to expiration

optional expiresAt: number

Remote image expiration date (unixtime, milliseconds)

  • Updatable
  • Based on Cache-Control or Expires header.
  • Equivalent to browser cache.

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) or hasher(src)
  • Data URL: hasher(base64)

height: number

Real height

lastUsedAt: number

Unixtime of the last used build (ms)

optional profile: string

Only for variant and placeholder

optional r: number

Dominant color based on sharp().stats()

  • Updatable

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

ImgProcDataAdapter.fetch


initialize(options): Promise<void>

Defined in: extras/LokiDataAdapter.ts:77

Async part of constructor

ImgProcDataAdapterInitOptions

Promise<void>

ImgProcDataAdapter.initialize


insert(data): void

Defined in: extras/LokiDataAdapter.ts:175

Insert the record

ImgProcFile

void

ImgProcDataAdapter.insert


list(): Set<string>

Defined in: extras/LokiDataAdapter.ts:166

List all hashes

Set<string>

ImgProcDataAdapter.list


renew(criteria): void

Defined in: extras/LokiDataAdapter.ts:207

Renew the record

ImgProcDataAdapterCriteria

void

ImgProcDataAdapter.renew


updateMetadata(data): void

Defined in: extras/LokiDataAdapter.ts:183

Update the record for remote file

number

number

string

number

string

number

number

number

void

ImgProcDataAdapter.updateMetadata