catbox-redis
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -143,5 +143,3 @@ | ||
if ((!envelope.item && envelope.item !== 0) || | ||
!envelope.stored) { | ||
if (!envelope.stored || !envelope.hasOwnProperty('item')) { | ||
throw Error('Incorrect envelope structure'); | ||
@@ -148,0 +146,0 @@ } |
{ | ||
"name": "catbox-redis", | ||
"description": "Redis adapter for catbox", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -8,6 +8,6 @@ catbox-redis [![Build Status](https://travis-ci.org/hapijs/catbox-redis.svg?branch=master)](https://travis-ci.org/hapijs/catbox-redis) | ||
## Options | ||
- `url` - the Redis server URL (if `url` is provided, `host`, `port`, and `socket` are ignored) | ||
- `tls` - the `tls` options passed to the underlying `ioredis` client | ||
- `host` - the Redis server hostname. Defaults to `'127.0.0.1'`. | ||
@@ -22,2 +22,18 @@ - `port` - the Redis server port or unix domain socket path. Defaults to `6379`. | ||
### Use a Custom Redis Client | ||
`catbox-redis` allows you to specify a custom Redis client. Using a custom `client` puts you in charge of lifecycle handling (client start/stop). | ||
**Requirements** | ||
- `client` must be compatible with the `ioredis` API | ||
- `client` must also expose the `status` property that needs to match `ready` when connected | ||
- `client` is ready when `client.status === 'ready'` resolves to `true` | ||
All other options of `catbox-redis` are ignored when providing a custom `client`. | ||
- `client` - a custom Redis client instance | ||
## Tests | ||
@@ -24,0 +40,0 @@ |
@@ -790,2 +790,21 @@ | ||
}); | ||
it('can store and retrieve falsy values such as boolean false', async () => { | ||
const options = { | ||
host: '127.0.0.1', | ||
port: 6379, | ||
partition: 'wwwtest' | ||
}; | ||
const key = { | ||
id: 'test', | ||
segment: 'test' | ||
}; | ||
const redis = new Redis(options); | ||
await redis.start(); | ||
await redis.set(key, false, 200); | ||
const result = await redis.get(key); | ||
expect(result.item).to.equal(false); | ||
}); | ||
}); | ||
@@ -792,0 +811,0 @@ |
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
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
35426
856
50
1