项目作者: wmik

项目描述 :
Third party PouchDB storage adapter for keyv.
高级语言: JavaScript
项目地址: git://github.com/wmik/keyv-pouchdb.git
创建时间: 2018-06-25T12:16:55Z
项目社区:https://github.com/wmik/keyv-pouchdb

开源协议:MIT License

下载




keyv+
PouchDB logo

keyv-pouchdb



Third party PouchDB storage adapter for Keyv.


Build Status
npm

Motivation

Leveraging pouchdb-lru-cache as a keyv-storage-adapter that complies with the api specs.

Installation

  1. $ npm install --save keyv-pouchdb
  2. # Then add a pouchdb adapter
  3. $ npm install pouchdb-adapter-memory --save
  4. $ npm install pouchdb-adapter-http --save
  5. $ npm install pouchdb-adapter-node-websql --save

Usage

  1. const KeyvPouchDB = require("keyv-pouchdb");
  2. const Keyv = require("keyv");
  3. const store = new KeyvPouchDB({
  4. // default options
  5. maxCacheSize: 5000000, // maximum cache size in bytes. 0 for limitless [memory only]
  6. overwriteExisting: false, // replace existing entries
  7. pouchDB: {
  8. // pouchDB configuration options
  9. adapter: "memory", // pouchdb adapter
  10. database: "keyv-pouchdb-cache", // database (string | uri)
  11. remoteConfig: {} // configuration options for remote database
  12. }
  13. });
  14. /*
  15. * or connect to a remote instance
  16. *
  17. * npx pouchdb-server --port 3000 --in-memory
  18. *
  19. */
  20. new KeyvPouchDB("http://localhost:3000/keyv-pouchdb-cache"); // loads `pouchdb-adapter-http`
  21. /*
  22. *
  23. * or maybe even sqlite3
  24. *
  25. */
  26. new KeyvPouchDB("database.db"); // loads `pouchdb-adapter-node-websql`
  27. /****************************/
  28. const keyv = new Keyv({ store });

License

MIT © wmik