Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redis-json

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-json - npm Package Compare versions

Comparing version 4.0.2 to 4.1.0

3

CHANGELOG.md

@@ -0,1 +1,4 @@

# v4.1.0
* adds `.del()` method
# v4.0.1

@@ -2,0 +5,0 @@ * `clearAll()` now scans the DB via `scan` command(with a COUNT 100), instead of getting all the prefixed keys via `keys` command which would block the DB if the list is huge

@@ -48,2 +48,3 @@ [redis-json](../README.md) › [JSONCache](jsoncache.md)

* [clearAll](jsoncache.md#clearall)
* [del](jsoncache.md#del)
* [get](jsoncache.md#get)

@@ -59,3 +60,3 @@ * [rewrite](jsoncache.md#rewrite)

Defined in src/lib/jsonCache.ts:54
Defined in src/lib/jsonCache.ts:55

@@ -79,3 +80,3 @@ Intializes JSONCache instance

Defined in src/lib/jsonCache.ts:170
Defined in src/lib/jsonCache.ts:171

@@ -89,2 +90,27 @@ Removes/deletes all the keys in the JSON Cache,

### del
▸ **del**(`key`: string): *Promise‹any›*
Defined in src/lib/jsonCache.ts:196
Removes the given key from Redis
Please use this method instead of
directly using `redis.del` as this method
ensures that even the corresponding type info
is removed. It also ensures that prefix is
added to key, ensuring no other key is
removed unintentionally
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`key` | string | Redis key |
**Returns:** *Promise‹any›*
___
### get

@@ -94,3 +120,3 @@

Defined in src/lib/jsonCache.ts:115
Defined in src/lib/jsonCache.ts:116

@@ -117,3 +143,3 @@ Retrieves the hashset from redis and

Defined in src/lib/jsonCache.ts:161
Defined in src/lib/jsonCache.ts:162

@@ -137,3 +163,3 @@ Replace the entire hashset for the given key

Defined in src/lib/jsonCache.ts:89
Defined in src/lib/jsonCache.ts:90

@@ -140,0 +166,0 @@ Flattens the given json object and

@@ -489,2 +489,22 @@ import { promisify } from 'util';

}
/**
* Removes the given key from Redis
*
* Please use this method instead of
* directly using `redis.del` as this method
* ensures that even the corresponding type info
* is removed. It also ensures that prefix is
* added to key, ensuring no other key is
* removed unintentionally
*
* @param key Redis key
*/
del(key) {
return __awaiter(this, void 0, void 0, function* () {
yield Promise.all([
this.redisClientInt.del(this.getKey(key)),
this.redisClientInt.del(this.getTypeKey(key)),
]);
});
}
/******************

@@ -491,0 +511,0 @@ * PRIVATE METHODS

@@ -491,2 +491,22 @@ 'use strict';

}
/**
* Removes the given key from Redis
*
* Please use this method instead of
* directly using `redis.del` as this method
* ensures that even the corresponding type info
* is removed. It also ensures that prefix is
* added to key, ensuring no other key is
* removed unintentionally
*
* @param key Redis key
*/
del(key) {
return __awaiter(this, void 0, void 0, function* () {
yield Promise.all([
this.redisClientInt.del(this.getKey(key)),
this.redisClientInt.del(this.getTypeKey(key)),
]);
});
}
/******************

@@ -493,0 +513,0 @@ * PRIVATE METHODS

2

package.json
{
"name": "redis-json",
"version": "4.0.2",
"version": "4.1.0",
"description": "A wrapper library to store JSON Objects in redis-hashsets and retrieve it back as JSON objects",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -101,3 +101,3 @@ # redis-json [![npm version](https://badge.fury.io/js/redis-json.svg)](https://badge.fury.io/js/redis-json) [![Build Status](https://travis-ci.com/AkashBabu/redis-json.svg?branch=master)](https://travis-ci.com/AkashBabu/redis-json) [![Coverage Status](https://coveralls.io/repos/github/AkashBabu/redis-json/badge.svg?branch=master)](https://coveralls.io/github/AkashBabu/redis-json?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/0015747bb31d085adae8/maintainability)](https://codeclimate.com/github/AkashBabu/redis-json/maintainability)

With custom stringifier and parser:
```TS
```typescript
const jsonCache = new JSONCache(redis, {

@@ -142,5 +142,2 @@ stringifier: {

## Mocha & Chai (Testing)
> npm test
## Coverage Report

@@ -150,6 +147,14 @@ > npm run coverage

## Contributions
This is open-source, which makes it obvious for any PRs, but I would request you to add necessary test-cases for the same
This is open-source, which makes it obvious for any PRs, but I would request you to add necessary test-cases for the same.
### Pre-requisites:
Run your redis-server and then point the same client to the same.
An easier way to start redis-server, provided you've already installed `docker` (else visit [this page](https://docs.docker.com/get-docker/)) is by running this command:
> docker run --rm -it --name redis -p 6379:6379 redis
We follow TDD approach, so write your test cases first and then run the same paralelly during development by running the following command:
> npm run test:dev
## LICENCE
MIT License

@@ -7,2 +7,3 @@ import { IOptions, ISetOptions } from '../interfaces';

clearAll(): Promise<any>;
del(key: string): Promise<any>;
}

@@ -78,2 +79,15 @@ /**

clearAll(): Promise<any>;
/**
* Removes the given key from Redis
*
* Please use this method instead of
* directly using `redis.del` as this method
* ensures that even the corresponding type info
* is removed. It also ensures that prefix is
* added to key, ensuring no other key is
* removed unintentionally
*
* @param key Redis key
*/
del(key: string): Promise<any>;
/******************

@@ -80,0 +94,0 @@ * PRIVATE METHODS

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc