# BLMOVE

> Move an element from one list to another, waiting until the source has one.

URL: https://docs.hotkv.com/commands/blmove/

```
BLMOVE source destination LEFT | RIGHT LEFT | RIGHT timeout
```

- Group: List
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`BLMOVE` is the blocking form of [LMOVE](https://docs.hotkv.com/commands/lmove/index.md). If the list at
`source` has an element, it is moved to `destination` at once, exactly as
`LMOVE` would. If `source` is empty or missing, the connection waits until
another client pushes to `source`, or until `timeout` passes.

`timeout` is in seconds and can have a fractional part. `0` waits forever.
Inside [MULTI](https://docs.hotkv.com/commands/multi/index.md) / [EXEC](https://docs.hotkv.com/commands/exec/index.md) and inside scripts,
`BLMOVE` never waits and replies at once as if the timeout had expired.

If, when an element becomes available, `destination` holds a value that is
not a list, the wait ends with a `WRONGTYPE` error and nothing is moved.

## Options

| Option | Effect |
| --- | --- |
| `LEFT` / `RIGHT` (first) | The end of `source` to pop from. |
| `LEFT` / `RIGHT` (second) | The end of `destination` to push to. |
| `timeout` | Seconds to wait; `0` waits forever. |

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Moved | Bulk string: the element that was moved | Same |
| Timeout expired | Nil bulk string | Null |

Errors:

- `ERR syntax error` if a direction is not `LEFT` or `RIGHT`.
- `ERR timeout is not a float or out of range`, `ERR timeout is negative`, or
  `ERR timeout is out of range` for a bad `timeout`.
- `WRONGTYPE` if `source` is not a list, or `destination` exists and is not a
  list when an element is moved.

## Examples

```
127.0.0.1:6379> RPUSH jobs:pending j1
(integer) 1
127.0.0.1:6379> BLMOVE jobs:pending jobs:active LEFT RIGHT 10
"j1"
127.0.0.1:6379> BLMOVE jobs:pending jobs:active LEFT RIGHT 0.5
(nil)
(0.50s)
```

## Compatibility

Same as Redis 7.4 and Valkey 8.

## See also

[LMOVE](https://docs.hotkv.com/commands/lmove/index.md), [BRPOPLPUSH](https://docs.hotkv.com/commands/brpoplpush/index.md), [BLPOP](https://docs.hotkv.com/commands/blpop/index.md),
[BLMPOP](https://docs.hotkv.com/commands/blmpop/index.md)