Registry / database / redis-types

redis-types

JSON →
library0.2.4jsnpmunverified

Redis type classes for Node.js providing object-oriented wrappers around Redis data structures (Key, String, List, Hash, Set, SortedSet). Version 0.2.4 is the latest release, last updated in 2015. It uses the 'redis' npm module under the hood and offers a fluent API with both uppercase and lowercase method aliases. Differentiators include simple instantiation with a key and automatic redis-connection reuse via the underlying redis client.

npm install redis-types
INSTALL
IMPORT
SIG · REDIS-TYPES
R
redis-types
databasejavascriptv0.2.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Key
const { Key } = require('redis-types')
import { Key } from 'redis-types'
Package uses CommonJS, not ESM.
RedisHash
const { RedisHash } = require('redis-types')
const RedisHash = require('redis-types').Hash
Exported name is 'RedisHash', not 'Hash'.
RedisList
const { RedisList } = require('redis-types')
const RedisList = require('redis-types').List
Exported name is 'RedisList', not 'List'.
RedisSet
const { RedisSet } = require('redis-types')
const RedisSet = require('redis-types').Set
Exported name is 'RedisSet', not 'Set'.
RedisSortedSet
const { RedisSortedSet } = require('redis-types')
const RedisSortedSet = require('redis-types').SortedSet
Exported name is 'RedisSortedSet', not 'SortedSet'.
String
const { String } = require('redis-types')
const RedisString = require('redis-types').RedisString
Exported as 'String', but often mistaken as 'RedisString'.

Demonstrates creating Key, Hash, and List objects with a redis client, performing basic operations.

const redis = require('redis'); const { Key, String, RedisHash, RedisList, RedisSet, RedisSortedSet } = require('redis-types'); const client = redis.createClient(); const myKey = new Key('mykey', client); myKey.set('value', (err, res) => { console.log('SET result:', res); }); const myHash = new RedisHash('myhash', client); myHash.hset('field1', 'val1', (err, res) => { myHash.hget('field1', (err, val) => { console.log('HGET:', val); }); }); const myList = new RedisList('mylist', client); myList.rpush('a', 'b', 'c', (err) => { myList.lrange(0, -1, (err, items) => { console.log('LRANGE:', items); }); });
Debug
Known issues
deprecatedredis-types has not been updated since 2015; it uses an old version of 'redis' module.
fix
Consider using ioredis or directly using the 'redis' module with modern patterns.
affects: >=0.0.0
gotchaConstructor takes (key, client?) - client is optional, defaults to require('redis').createClient()
fix
Explicitly pass the redis client to avoid global state.
affects: >=0.0.0
gotchaPub/Sub is not implemented despite being listed in README.
fix
Use the 'redis' module directly for pub/sub.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: RedisHash is not a constructor
Importing as require('redis-types').Hash instead of .RedisHash
fix
Use const { RedisHash } = require('redis-types');
Module not found: Can't resolve 'redis-types'
Package not installed or typo in require path.
fix
Run 'npm install redis-types' and ensure correct import.
Upgrade
Version history
0.2.4latest on npm
Audit
Dependencies
redisrequiredredis-types wraps the 'redis' module; it must be installed separately
Agent activity
10 hits · last 30 days
node
8
Meta
1
Resources
redis-types — npm install redis-types · libregistry