Giter Site home page Giter Site logo

timmikeladze / keyv-arango Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 32 KB

ArangoDB store for Keyv: simple key-value storage with support for multiple backends.

License: MIT License

JavaScript 18.97% TypeScript 81.03%
cache keyv arango arangodb keyvaluestore key-value key-value-store storage

keyv-arango's Introduction

keyv-arango

ArangoDB store for Keyv: simple key-value storage with support for multiple backends.

Install

npm install keyv-arango keyv arangojs
# or
yarn add keyv-arango keyv arangojs
# or
pnpm add keyv-arango keyv arangojs

Usage

import Keyv from 'keyv'
import { KeyvArango, KeyvArangoOptions } from 'keyv-arango'

const options: KeyvArangoOptions = {
  // An ArangoDB database config object. This field is required.
  // If no database is specified, the default `_system` database will be used.
  config: {
    url: process.env.ARANGO_URL
  },
  // All fields below are optional.
  cacheCollection: true, // whether to cache the collection instance in between data calls. Defaults to true.
  collectionName: 'keyv', // the name of the collection to use. Defaults to 'keyv'.
  expireAfter: 0, // how long to wait before expiring a key (in milliseconds). Defaults to 0.
  field: 'expireDate', // the name of the field which will store the expiration date. Defaults to 'expireDate'.
  namespace: null // the keyv namespace to use. Defaults to null.
}

const store = new KeyvArango(options)

const keyv = new Keyv({ store })

// From here on, you can use keyv as usual.

await keyv.set('foo', 'bar', 1000)

await keyv.get('foo')

ArangoDB and TTL Indexes

When using TTL indexes in ArangoDB is no guarantee that a key will be deleted at the exact time specified, only that the key will be deleted. ArangoDB runs a background thread which is responsible for cleaning up keys. The frequency of this thread is configurable, but defaults to 30 seconds.

This is an important caveat to keep in mind when using this library and ArangoDB in general. Without prior configuration, ArangoDB is not suitable for short-lived keys. When starting an ArangoDB instance the --ttl.frequency option can be used to configure the frequency of the background thread. For more information, see the ArangoDB documentation. In fact the CI tests for this library use a frequency of 1 second to ensure that the tests pass in a timely manner.

keyv-arango's People

Contributors

renovate[bot] avatar timmikeladze avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

keyv-arango's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update dependency typescript to v5

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

  • Update all non-major dependencies (@keyv/test-suite, @types/node, @typescript-eslint/eslint-plugin, @typescript-eslint/parser, arangojs, ava, commit-it, eslint, eslint-plugin-import, eslint-plugin-n, eslint-plugin-typescript-sort-keys, husky, lint-staged, prettier, release-it, typescript)

Detected dependencies

docker-compose
docker-compose.yml
github-actions
.github/workflows/main.yml
  • actions/checkout v3
  • actions/setup-node v3
  • c-hive/gha-yarn-cache v2
  • isbang/compose-action v1.4.1
npm
package.json
  • @keyv/test-suite 1.8.8
  • @types/node 18.11.13
  • @typescript-eslint/eslint-plugin 5.46.1
  • @typescript-eslint/parser 5.46.1
  • arangojs 8.0.0
  • ava 5.1.0
  • commit-it 0.0.7
  • eslint 8.29.0
  • eslint-config-standard 17.0.0
  • eslint-plugin-import 2.26.0
  • eslint-plugin-n 15.6.0
  • eslint-plugin-node 11.1.0
  • eslint-plugin-promise 6.1.1
  • eslint-plugin-typescript-sort-keys 2.1.0
  • husky 8.0.2
  • keyv 4.5.2
  • lint-staged 13.1.0
  • microbundle 0.15.1
  • prettier 2.8.1
  • release-it 15.5.1
  • typescript 4.9.4
  • arangojs >=7.0.0
  • keyv >=4.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Cannot install npm package

Attempting to install this with npm results in an error:

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path C:\Code\my_project\node_modules\keyv-arango\dist\cli.module.js
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, chmod 'C:\Code\my_project\node_modules\keyv-arango\dist\cli.module.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

I manually downloaded the tarball and it does not contain any file for dist\cli.module.js.
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.