Skip to content

statsig-io/node-js-server-sdk-redis

Repository files navigation

Statsig Node Server SDK - Redis Integration

npm version

A first party Redis integration with the Statsig server-side Node.js SDK.

Quick Setup

  1. Install the Statsig Node SDK
npm install statsig-node
  1. Install this package
npm install statsig-node-redis
  1. Import the package
import RedisDataAdapter from 'statsig-node-redis'
  1. Create an instance of the RedisDataAdapter
const dataAdapter = new RedisDataAdapter({url: "redis://statsig:foo@bar.redis.server:6380"});
  1. 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(
  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

Links

Node Redis

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published