cachier-db
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.
Kind: global class
new CachierDB([opts], [readFormatter], [writeFormatter], [log])
Constructor
| Param | Type | Description |
|---|---|---|
| [opts] | TemplateDBOpts | The TemplateDBOpts |
| [readFormatter] | function | 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 | 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 | The log for handling logging output |
| [log.debug] | function | A function that will accept debug level logging messages (i.e. debug('some message to log')) |
| [log.info] | function | A function that will accept info level logging messages (i.e. info('some message to log')) |
| [log.warn] | function | A function that will accept warning level logging messages (i.e. warn('some message to log')) |
| [log.error] | function | A function that will accept error level logging messages (i.e. error('some message to log')) |
cachierDB.operations
Kind: instance property of CachierDB
cachierDB.register()
Kind: instance method of CachierDB
cachierDB.compile()
Kind: instance method of CachierDB
cachierDB.read()
Kind: instance method of CachierDB
cachierDB.write()
Kind: instance method of CachierDB
cachierDB.clear([all])
Clears templates that may reside in-memory, optionally clears the IndexedDB keys in the cache store(s) and closes any lingering DB connections.
Kind: instance method of CachierDB
| Param | Type | Default | Description |
|---|---|---|---|
| [all] | Boolean | true | When true all of the keys in the IndexedDB cache store(s) will be removed |