Socket
Socket
Sign inDemoInstall

catbox-disk

Package Overview
Dependencies
11
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    catbox-disk

Disk storage adapter for catbox


Version published
Weekly downloads
75
decreased by-2.6%
Maintainers
3
Install size
497 kB
Created
Weekly downloads
 

Readme

Source

catbox-disk Build Status

Disk storage adapter for catbox.

Lead Maintainer - Andrew Hughes

Code liberally cribbed from various other adapter examples, primarily

Version Note:

Users of Hapi less than v17 should use the 2.x.x version of this plugin. For Hapi v17 and above use version 3.x.x or greater.

Example invocations:

>= Hapi v17.0.0:
const Hapi = require('hapi');
const Disk = require('catbox-disk');

const server = new Hapi.Server({
    cache : [{
            name      : 'diskCache',
            engine    : new Disk({
              cachePath: '/some/existing/dir',
              cleanEvery: 3600000,
              partition : 'cache'
            }),
    }]
});
< Hapi v17.0.0:
const Hapi = require('hapi');
const Disk = require('catbox-disk');

const server = new Hapi.Server({
    cache : [{
            name      : 'diskCache',
            engine    : Disk,
            cachePath: '/some/existing/dir',
            cleanEvery: 3600000,
            partition : 'cache'
    }]
});

Opttions:

  • cachePath : string required - a pre-existing path you want to store your cache files in
  • cleanEvery : integer <default 1 hour> optional - number of milliseconds between each cache cleanup for disk space recovery. Set to 0 to deactivate entirely.

Notes:

  • This cache backend stores everything in flat .json files with MD5 hashed filenames based off the keys to avoid encoding issues & length limits at the filesystem level.
  • Initial hash character prefixes are used to split file storage into multiple sub directories to avoid excessive file counts in any one directory, e.g. ABCD1234DEADBEEF.json is stored in .../AB/CD/ABCD1234DEADBEEF.json
  • This cache doesn't set an upper limit on disk usage. Plan accordingly, and monitor your free drive space if you're not certain about behavior.
  • Old, un-accessed files are automatically purged via the cleanEvery interval option, which is active by default. If you never access an old cached file, it will take up drivespace until deleted, which is why this option is important. Be mindful if you deactivate it.

Keywords

FAQs

Last updated on 11 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc