---
title: "lock ttl · RUAL Documentation"
description: "Returns the time to live for a given lock"
canonical: https://docs.rual.nl/block-types/locking/function_claim_lock_ttl
language: en
---

# lock ttl

This block is part of the [`locking`](https://docs.rual.nl/block-types/locking) group and was last modified in core [`v12.0.7`](https://docs.rual.nl/core-versions/120007).

Returns the time to live for a given lock

- flow `flow`

- key required `value` the lock key to be checked

- flow `flow`

- ttl `number` Returns the ttl in seconds. Returns `-1` if the key exists but has no associated expire. Returns `-2` if the key does not exist.

| `expiry` |
| --- |
| `expire` |

A typical wiring for [lock ttl](https://docs.rual.nl/block-types/locking/function_claim_lock_ttl): a [function trigger](https://docs.rual.nl/block-types/globals/trigger_custom_function) starts the flow; [value](https://docs.rual.nl/block-types/value/value_default) feeds the `key` pin; the `flow` out pin feeds [debug](https://docs.rual.nl/block-types/state%20ui/state_debug).

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

### Version history

Introduced in [`v12.0.7`](https://docs.rual.nl/core-versions/120007).
