Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Latest commit

 

History

History

06_Data_Redis_JS

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

redisjs Function

Connects to a Redis instance and perform the following operations:

  1. Stores the last invocation ID in Redis
  2. Stores the last invocation time in Redis
  3. Adds the invocation ID to a list in Redis
  4. Returns the list of invocation IDs from Redis

Local Development

  1. Export your Heroku Data for Redis configuration

Make sure you have the REDIS_URL connection string in the .env file of this folder. For using this recipe on a Compute Environment please refer to the Heroku Data in Functions documentation.

heroku config -a <app_name> --shell > .env
  1. Install dependencies with
npm install
  1. Run tests with
npm test
  1. Start your function locally
sf run function start --verbose
  1. Invoke your function locally
sf run function --function-url=http://localhost:8080 --payload='{}'