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

# get cache ttl

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

### 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.

get the time to live in seconds

- flow `flow`

- TTL `number` Current time to live in seconds. Redis' own sentinels are passed through: `-1` when the key exists but has no expiry, `-2` when the key does not exist.

- exists `v15.0.0` `condition` False when the key does not exist (TTL `-2`).

- has expiry `v15.0.0` `condition` False when the key exists but never expires (TTL `-1`), or when it does not exist at all.

- key `v15.0.0` `value` The resolved cache key.

| `redis` |
| --- |

A typical wiring for [get cache ttl](https://docs.rual.nl/block-types/redis/function_redis_cache_get_ttl): a [function trigger](https://docs.rual.nl/block-types/globals/trigger_custom_function) starts the flow; the `flow` out pin feeds [debug](https://docs.rual.nl/block-types/state%20ui/state_debug).

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

### Version history

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

Last modified in [`v15.0.0`](https://docs.rual.nl/core-versions/150000).
