underflag-memcached
v1.0.3
Published
memcached provider for underflag
Downloads
1
Maintainers
Readme
Memcached Provider
This is a Memcached provider for underflag (feature flag/feature toggle)
Install
Using npm:
npm install underflag-memcached
Using yarn:
yarn add underflag-memcached
How to use
Import the underflag and prepare to load data provider
import { Underflag, JsonDataProvider } from "underflag";
import { MemcachedDataProvider } from "underflag-memcached";
import memjs from 'memjs';
// memcached cache provider
const client = memjs.Client.create();
const cacheProvider = new MemcachedCacheProvider({ client, lifetime: 60 });
const dataProvider = new JsonDataProvider({ data: { feature: true }});
const underflag = new Underflag({ dataProvider, cacheProvider });
if (await underflag.isOn("feature")) {
// ...
}
Attention: Do not forget of create the features collection in memcached with the key and value fields.
Know more on underflag npm page