CachierDB

CachierDB

Persistence cache manager that uses an IndexedDB or LevelDB store for partial content and compilation segments. The type of DB used is first determined by the presence of an indexedDB on the global/window reference that contains either an IDBFactory or other supported IndexedDB-like interface (e.g. LevelUP). When an indexedDB reference is not present, an atempt to load a module using the options.dbTypeName as the module name/path that resolves into a function that takes a location path from options.dbLocName as it's first argument.

Constructor

new CachierDB(optsopt, readFormatteropt, writeFormatteropt, logopt)

Constructor

Source:
Parameters:
Name Type Attributes Description
opts TemplateDBOpts <optional>

The TemplateDBOpts

readFormatter function <optional>

The function(string, readFormatOptions) that will return a formatted string for reading data using the options.readFormatOptions from TemplateOpts as the formatting options. Typically reads are for HTML minification and/or beautifying. NOTE: Use with caution as syntax errors may result depending on the formatter used and the complexity of the data being formatted!

writeFormatter function <optional>

The function(string, writeFormatOptions) that will return a formatted string for writting data using the options.writeFormatOptions from TemplateOpts as the formatting options. Typically reads are for JS minification and/or beautifying. NOTE: Use with caution as syntax errors may result depending on the formatter used and the complexity of the data being formatted!

log Object <optional>

The log for handling logging output

Name Type Attributes Description
debug function <optional>

A function that will accept debug level logging messages (i.e. debug('some message to log'))

info function <optional>

A function that will accept info level logging messages (i.e. info('some message to log'))

warn function <optional>

A function that will accept warning level logging messages (i.e. warn('some message to log'))

error function <optional>

A function that will accept error level logging messages (i.e. error('some message to log'))

Members

operations

Source:

Methods

(async) clear(allopt)

Clears templates that may reside in-memory, optionally clears the IndexedDB keys in the cache store(s) and closes any lingering DB connections.

Source:
Parameters:
Name Type Attributes Default Description
all Boolean <optional>
true

When true all of the keys in the IndexedDB cache store(s) will be removed

(async) compile()

Source:

(async) read()

Source:

(async) register()

Source:

(async) write()

Source:

1.0.0 (2019-12-16)

Full Changelog