Skip to content

configcat-labs/configcat-with-redis-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to use ConfigCat with Redis | Sample application

This is a companion repo the the blog article titled: How to use ConfigCat with Redis. The article walks you through understanding how Redis works and how you can use it alongside ConfigCat in a Node.js console application.

Build & Run

1. Clone the GitHub repository

2. Run the following commands to install the required node packages:

npm install

The configcat-node and redis npm packages will also be installed using this command. The configcat-node package will be used as a client to connect to and pull the feature flag status from your ConfigCat dashboard. redis will be used similarly, and would connect to a local docker instance of Redis.

3. Using docker, pull the latest Redis docker image and run the container:

docker pull redis
docker run --name container-redis -p 6379:6379 -d redis

4. Start the node application with the following command:

npm start

You should see the following output logged to your terminal every 5 seconds:

> configcat-with-redis-sample@1.0.0 start
> node index.js

Connected to Redis
17:56:55 GMT-0300 (French Guiana Time) isMyAwesomeFeatureEnabled: false
17:57:00 GMT-0300 (French Guiana Time) isMyAwesomeFeatureEnabled: false
17:57:05 GMT-0300 (French Guiana Time) isMyAwesomeFeatureEnabled: false
17:57:10 GMT-0300 (French Guiana Time) isMyAwesomeFeatureEnabled: false
17:57:15 GMT-0300 (French Guiana Time) isMyAwesomeFeatureEnabled: false
17:57:20 GMT-0300 (French Guiana Time) isMyAwesomeFeatureEnabled: false

Toggling on or off the feature flag within your ConfigCat dashboard will force the cache to refresh. As a result, The new value will be pulled from ConfigCat to replace the existing value in the cache.

Learn more

Useful links to technical resources.

ConfigCat also supports many other frameworks and languages. Check out the full list of supported SDKs here.

You can also explore other code samples for various languages, frameworks, and topics here in the ConfigCat labs on GitHub.

Keep up with ConfigCat on Twitter, Facebook, LinkedIn, and GitHub.

Author

Chavez Harris

Contributions

Contributions are welcome!

About

Companion code repository for article: How to use ConfigCat with Redis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published