This is a node for n8n that provides intelligent Redis cache management with automatic renewal capabilities.
- Store data in Redis with configurable expiration
- Retrieve cached data with automatic expiration checks
- Proactive cache renewal based on configurable thresholds
- Support for JSON data structures
- Simple and intuitive interface
- Go to Settings > Community Nodes
- Click on Install
- Enter
n8n-nodes-redis-anyway
in the input field - Click on Install
- Clone this repository
- Install dependencies:
pnpm install
- Build:
pnpm build
- Copy
dist
folder to n8n custom nodes directory (usually~/.n8n/custom
)
We provide a convenient script to manage the test environment. First, make the script executable:
chmod +x scripts/test-environment.sh
This will build the plugin and start n8n with Redis:
./scripts/test-environment.sh start
The script will:
- Check if pnpm is installed (and install if needed)
- Check if Docker is running
- Build the plugin
- Start n8n and Redis containers
- Display the necessary Redis credentials
Once started, access n8n at http://localhost:5678
Use these Redis credentials in n8n:
- Host:
redis
- Port:
6379
- Password: (leave empty)
If you make changes to the plugin code, rebuild it with:
./scripts/test-environment.sh rebuild
To stop n8n and Redis:
./scripts/test-environment.sh stop
This node allows you to store data in Redis with a specified expiration time.
- Key: The key under which to store the data
- Value: The value to store (supports JSON)
- Expiration: Time in seconds after which the data will expire
{
"key": "user:123",
"value": "{\"name\":\"John\",\"age\":30}",
"expiration": 3600
}
This node retrieves data from Redis and provides three possible outputs based on the cache state.
- Key: The key to retrieve data from
- Renewal Threshold: Time in seconds before expiration to trigger renewal
- Valid Cache: Contains the cached data if it exists and is not expired
- Invalid Cache: Triggered when the cache is expired or doesn't exist
- Needs Renewal: Triggered when the cache is valid but close to expiration (based on threshold)
[HTTP Request] -> [Redis Get Cache]
|
├─> [Valid Cache] -> [Use Data]
|
├─> [Invalid Cache] -> [Fetch New Data] -> [Redis Set Cache]
|
└─> [Needs Renewal] -> [Background Fetch] -> [Redis Set Cache]
Configure your Redis connection in n8n's credentials:
- Go to Credentials
- Click Add Credential
- Select Redis
- Fill in:
- Host (default: localhost)
- Port (default: 6379)
- Password (optional)
- Clone repository
- Install dependencies:
pnpm install
- Build:
pnpm build
- Link to n8n:
pnpm link
- Start n8n:
n8n start
MIT
Matheus Kindrazki (kindra.fireflies@gmail.com)