Statsig Node Server SDK - Redis Integration
A first party Redis integration with the Statsig server-side Node.js SDK.
Quick Setup
- Install the Statsig Node SDK
npm install statsig-node
- Install this package
npm install statsig-node-redis
- Import the package
import { RedisDataAdapter } from 'statsig-node-redis'
- Create an instance of the
RedisDataAdapter
const dataAdapter = new RedisDataAdapter();
- When initializing the
statsig
sdk, add the adapter to options
await statsig.initialize(
'server-secret-key',
{ dataAdapter: dataAdapter },
);
Customizing the adapter
When initializing RedisDataAdapter
, you can specify the following options:
const dataAdapter = new RedisDataAdapter(
hostname,
port,
password,
db,
);
param | default | description |
---|---|---|
hostname | 'localhost' | Redis server hostname |
port | 6379 | Redis server port |
password | ACL password or the old "--requirepass" password | |
db | 0 | Redis database number (supports 16 databases) |