Skip to main content

redis

Ultra-fast in-memory data store for caching, pub/sub messaging, and real-time data.

Overview

The redis node provides ultra-fast in-memory data storage with Redis. Use it for caching sensor data, rate limiting, session storage, pub/sub messaging, and any scenario requiring microsecond response times.

<1ms
Latency
Pub/Sub
Messaging
TTL
Auto-Expiry
Cluster
Scalable

Properties

Property Type Default Description
host string "localhost" Redis host
port number 6379 Redis port
command string "SET" Redis command to execute
key string "msg.topic" Key name or path
ttl number 0 Time-to-live in seconds (0 = no expiry)

Common Commands

String Operations

SET key value

GET key

SETEX key ttl value

INCR / DECR key

Hash Operations

HSET key field value

HGET key field

HGETALL key

HINCRBY key field n

List Operations

LPUSH key value

RPUSH key value

LRANGE key 0 -1

LLEN key

Pub/Sub

PUBLISH channel message

SUBSCRIBE channel

PSUBSCRIBE pattern*

Example: Caching API Responses

Cache expensive API calls for 5 minutes to reduce load.

// Check cache first
// Redis GET: key = "weather:london"

// If cache miss, fetch from API then cache result
// SET weather:london "{temp: 15, condition: 'cloudy'}" EX 300

// Function node to handle cache logic
var cached = msg.payload;
if (cached) {
    msg.payload = JSON.parse(cached);
    msg.cached = true;
    return [msg, null]; // First output (cached)
} else {
    return [null, msg]; // Second output (fetch)
}

Related Nodes