n8n’s Redis node supports the standard Redis operations (GET, SET, DEL, HGET, HSET, LPUSH, RPUSH, PUB, SUB). The right answer is to use the node for simple cache and pub/sub, the Code node for complex Redis pipelines (MULTI/EXEC, Lua scripts), and the Redis Chat Memory node for LLM memory (the MemoryRedisChat node). The mistake every team makes: the team uses SET with no TTL, the key lives forever, the team’s Redis fills up, the workflow starts failing on memory pressure.
Table of contents
- The operations — GET, SET, DEL, HGET, HSET
- The list operations — LPUSH, RPUSH, LPOP, RPOP, LRANGE
- The pub/sub — PUBLISH, SUBSCRIBE, PSUBSCRIBE
- The connection — how the node connects to Redis
- The one mistake that blocks the workflow
- The Code node — when to use it for Redis
- The Redis Chat Memory node — for LLM memory
- The TTL — the right answer for any cache key
- How this fits the rest of the stack
- FAQ
The operations — GET, SET, DEL, HGET, HSET
The standard string operations are GET, SET, DEL. The right answer is to use SET with a TTL for any cache key (the key expires, the memory is reclaimed, the team does not have to clean up). The wrong answer is to use SET without a TTL for a cache key — the key lives forever, the team’s Redis fills up.
The standard hash operations are HGET, HSET, HDEL, HGETALL. The right answer is to use a hash for a structured cache (a user’s session, a row from the database). The wrong answer is to use a hash for a simple value (a single number, a string) — the hash has overhead, the string is simpler.
The list operations — LPUSH, RPUSH, LPOP, RPOP, LRANGE
The list operations are LPUSH, RPUSH, LPOP, RPOP, LRANGE, LREM, LLEN. The right answer is to use a list for a queue (LPUSH to enqueue, RPOP to dequeue) or a recent-items list (LPUSH to add, LRANGE 0 9 to get the recent 10). The wrong answer is to use a list for a large dataset (the list operations are O(N) for large lists).
The pub/sub — PUBLISH, SUBSCRIBE, PSUBSCRIBE
The pub/sub operations are PUBLISH, SUBSCRIBE, PSUBSCRIBE. The right answer is to use pub/sub for a fan-out pattern (one producer, multiple consumers, fire-and-forget). The wrong answer is to use pub/sub for a durable message queue — pub/sub messages are not stored, the team that is not subscribed misses the message.
The connection — how the node connects to Redis
The Redis node connects via the connection config (host, port, password, database number). The right answer is to set the connection in the n8n credentials store, not in the workflow. The right answer for a managed Redis is the connection string from the provider’s dashboard, the right answer for a self-hosted Redis is the host/port/password the team configured.
The one mistake that blocks the workflow
The mistake is the wrong connection string. The team’s n8n instance is on a different network than the Redis instance, the connection fails, the workflow errors. The right answer is to check the network: is the Redis on a public network? Is the n8n instance in the same VPC? Is the firewall open? The right answer is to test the connection from the n8n host with redis-cli -h <host> -p <port> PING.
The Code node — when to use it for Redis
The right answer for the n8n Code node with Redis is when the team needs MULTI/EXEC, Lua scripts, or a pipeline of commands. The right answer for a single GET/SET is the Redis node. The right answer for a pipeline of 5 GETs is the Code node with redis.pipeline([...]).exec().
The Redis Chat Memory node — for LLM memory
The MemoryRedisChat node is for LLM memory. The team’s LangChain agent stores the conversation history in Redis, the team does not lose the context between turns. The right answer is the Redis Chat Memory node for an LLM agent that needs persistent context. The wrong answer is to roll a custom memory store — the LangChain integration is the right answer.
The TTL — the right answer for any cache key
The right answer for any cache key is to set a TTL. The key expires, the memory is reclaimed, the team does not have to clean up. The right answer for a 1-hour cache is SET key value EX 3600. The right answer for a 1-day cache is SET key value EX 86400. The wrong answer is SET key value with no TTL — the key lives forever, the team’s Redis fills up.
How this fits the rest of the stack
The infrastructure question is a small piece of a larger pattern: the team’s runtime, storage, database, secret store, logs, and deployment platform are all parts of the same platform. The right answer is to model the full stack before the project ships, not after. The RunxBuild hosting calculator is the right place to do that exercise — pick the runtime, the memory tier, the storage, the secret store, and the egress, and the calculator shows what the deploy actually costs at the team’s actual usage.
Useful related references:
FAQ
What operations does the n8n Redis node support?
GET, SET, DEL, HGET, HSET, LPUSH, RPUSH, LPOP, RPOP, LRANGE, PUBLISH, SUBSCRIBE, and more.
How do I set a TTL in the n8n Redis node?
Use the SET operation with the EX parameter (EX 3600 for 1 hour). The right answer is to always set a TTL for a cache key.
Can the n8n Redis node do pub/sub?
Yes — the PUBLISH and SUBSCRIBE operations. The right answer is pub/sub for a fan-out pattern, a message queue for a durable pattern.
How do I connect the n8n Redis node to a managed Redis?
Set the host, port, password from the managed Redis dashboard in the n8n credentials store. The right answer is to test the connection with redis-cli -h <host> -p <port> PING.
Can I use the n8n Redis node for a queue?
Yes — use LPUSH to enqueue, RPOP to dequeue. The right answer is a list for a queue, a stream (XADD/XREAD) for a durable queue with consumer groups.
What is the Redis Chat Memory node for?
For LLM memory. The team’s LangChain agent stores the conversation history in Redis, the team does not lose the context between turns.
How do I use a Redis pipeline in n8n?
Use the Code node with redis.pipeline([...]).exec(). The right answer is the Redis node for a single command, the Code node for a pipeline.
What is the difference between Redis and Memcached?
Redis supports more data types (strings, hashes, lists, sets, sorted sets, streams), has pub/sub, and has persistence. Memcached is simpler, faster for simple GET/SET, and has no persistence. The right answer is Redis for a team that needs the data types or the pub/sub, Memcached for a team that just needs a simple cache.