@textile/datastore-ttl
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -63,3 +63,3 @@ /// <reference types="node" /> | ||
* @param keys The keys | ||
* @param ttl The time-to-live, in milliseconds. Skips update if not specified. | ||
* @param ttl The time-to-live, in milliseconds. Skips update if not specified or infinitely large. | ||
*/ | ||
@@ -66,0 +66,0 @@ protected addTTL(keys: Key[], ttl?: number): Promise<void>; |
@@ -131,7 +131,7 @@ "use strict"; | ||
* @param keys The keys | ||
* @param ttl The time-to-live, in milliseconds. Skips update if not specified. | ||
* @param ttl The time-to-live, in milliseconds. Skips update if not specified or infinitely large. | ||
*/ | ||
addTTL(keys, ttl) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (ttl === undefined) | ||
if (ttl === undefined || ttl == Infinity) | ||
return; | ||
@@ -138,0 +138,0 @@ // @todo: Can we share a single 'batch' between addTTL and removeTTL? |
{ | ||
"name": "@textile/datastore-ttl", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "An implementation of the Datastore interface that supports a time-to-live for key-value pairs.", | ||
@@ -42,3 +42,3 @@ "main": "dist/index", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.12.17", | ||
"@types/node": "^13.1.2", | ||
"@typescript-eslint/eslint-plugin": "^2.9.0", | ||
@@ -45,0 +45,0 @@ "@typescript-eslint/parser": "^2.9.0", |
@@ -9,4 +9,4 @@ # Time to Live Datastore _(datastore-ttl)_ | ||
[![Release](https://img.shields.io/github/release/textileio/js-datastore-ttl.svg?style=flat-square)](https://github.com/textileio/js-datastore-ttl/releases/latest) | ||
[![docs](https://img.shields.io/badge/docs-master-success.svg?style=popout-square)](https://textileio.github.io/js-datastore-ttl) | ||
[![CircleCI branch](https://img.shields.io/circleci/project/github/textileio/js-datastore-ttl/master.svg?style=flat-square)](https://circleci.com/gh/textileio/js-datastore-ttl) | ||
[![Docs](https://img.shields.io/badge/docs-master-success.svg?style=popout-square)](https://textileio.github.io/js-datastore-ttl) | ||
[![Workflow](https://img.shields.io/github/workflow/status/textileio/js-datastore-ttl/Lint%20&%20Test?style=flat-square)](https://github.com/textileio/js-datastore-ttl/actions) | ||
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) | ||
@@ -59,2 +59,5 @@ | ||
// Simple promise-based sleep function | ||
const sleep = (ms: number) => new Promise(r => setTimeout(r, ms)) | ||
// Use any compliant Datastore | ||
@@ -61,0 +64,0 @@ const child = new MemoryDatastore() |
@@ -121,6 +121,6 @@ import { Buffer } from 'buffer' | ||
* @param keys The keys | ||
* @param ttl The time-to-live, in milliseconds. Skips update if not specified. | ||
* @param ttl The time-to-live, in milliseconds. Skips update if not specified or infinitely large. | ||
*/ | ||
protected async addTTL(keys: Key[], ttl?: number) { | ||
if (ttl === undefined) return | ||
if (ttl === undefined || ttl == Infinity) return | ||
// @todo: Can we share a single 'batch' between addTTL and removeTTL? | ||
@@ -127,0 +127,0 @@ await this.lock.writeLock() |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30
101
90672
1