---
title: "set cache ttl · RUAL Documentation"
description: "set the time to live in seconds"
canonical: https://docs.rual.nl/block-types/redis/function_redis_cache_ttl
language: en
---

# set cache ttl

This block is part of the [`redis`](https://docs.rual.nl/block-types/redis) group and was last modified in core [`v13.0.6`](https://docs.rual.nl/core-versions/130006).

### Redis Key Selection Required

This block relies on a Redis key to perform its redis releated actions. You must manually select the Redis key you want to use in the flow in the blueprint using the Redis key selector modal. To access the modal, click the white button on the block.

set the time to live in seconds

- flow `flow`

- TTL required `number` Time to live in seconds.

Default `60`

- flow `flow`

- error `value`

| `redis ttl` |
| --- |
| `cache ttl` |

A typical wiring for [set cache ttl](https://docs.rual.nl/block-types/redis/function_redis_cache_ttl): [increment](https://docs.rual.nl/block-types/redis/function_redis_cache_incr_key) feeds the `flow` pin; [remote ip](https://docs.rual.nl/block-types/http%20connection/httpconnection_get_ip) feeds the `key` pin; [one minute](https://docs.rual.nl/block-types/number/number_one_minute) feeds the `ttl` pin; the `flow` out pin feeds [branch](https://docs.rual.nl/block-types/flow/branch); the `error` out pin feeds [increment](https://docs.rual.nl/block-types/redis/function_redis_cache_incr_key).

![Studio canvas example for the set cache ttl block: typical wiring for set cache ttl.](https://docs.rual.nl/canvas-examples/function_redis_cache_ttl.png)

### Commonly used with

In production blueprints, this block is most often wired together with:

- [increment](https://docs.rual.nl/block-types/redis/function_redis_cache_incr_key): wired in both directions with this block. Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation.

- [remote ip](https://docs.rual.nl/block-types/http%20connection/httpconnection_get_ip): feeds into this block. Returns the currently connected user IP.

- [branch](https://docs.rual.nl/block-types/flow/branch): wired in both directions with this block.

- [one minute](https://docs.rual.nl/block-types/number/number_one_minute): feeds into this block. Returns one minute in seconds as a number.

- [number](https://docs.rual.nl/block-types/number/number_default): feeds into this block. Generates a valid number from the filled custom value in the blueprint.

- [update document](https://docs.rual.nl/block-types/storage/function_update_document_mutations): this block feeds into it. Update document in the given storage and creates a revision for it.

### Used in these guides

These documentation pages use or explain this block:

- [Common Blueprint Patterns](https://docs.rual.nl/blueprints/common-patterns)

### Version history

Introduced in [`v11.0.0`](https://docs.rual.nl/core-versions/110000).

Last modified in [`v13.0.6`](https://docs.rual.nl/core-versions/130006).

### Service documentation
