A first party Redis integration with the Statsig server-side Node.js SDK.
- 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({url: "redis://statsig:foo@bar.redis.server:6380"});
- When initializing the
statsig
sdk, add the adapter to options
await statsig.initialize(
'server-secret-key',
{ dataAdapter: dataAdapter },
);
When initializing RedisDataAdapter
, you can specify the following options:
const dataAdapter = new RedisDataAdapter(
redisOptions,
statsigCacheKey,
);
param | default | description |
---|---|---|
redisOptions | {} | Options for initializing the Redis client (the database must be specified in order for the adapter to work) |
statsigCacheKey | 'statsig-redis' | The key that the adapter will use to store data in Redis |