Skip to content

TTL, rename, copy and bulk delete

  • Redis / Valkey

From a key’s value editor you can set or remove its time to live, rename it and copy it, to another database too. From the key browser you can delete every key that matches a pattern, after a dry run that counts them first.

  1. Open the key and choose TTL….
  2. In Time to live, enter a number in Expire in and pick the Unit: milliseconds, seconds, minutes, hours or days.
  3. Choose Set TTL.

The header then shows the time left, such as 2 min. To make the key permanent again, choose Persist (no expiry) in the same dialog.

Choose Rename…, enter the New name and choose Rename. If a key with that name exists, the rename is refused unless you tick Replace it if a key with that name exists, and replacing it asks first. The editor then shows the key under its new name.

Choose Copy…, enter the name in Copy to key and, outside Cluster mode, pick the target Database (the current one is marked “this one”). Tick Replace it if a key with that name exists to overwrite a key of that name. Choose Copy; the copy opens in its own editor.

Delete in the value editor, Delete key… in the side bar tree and the Delete key in the key browser delete one key, after a confirmation.

  1. In the key browser, choose Bulk delete…. The Pattern starts as the browser’s pattern; if a Key type is set, only keys of that type are deleted.
  2. Choose Count matching keys. This is the dry run: SCAN counts the matching keys and nothing is deleted, for example “30 keys match session:*”.
  3. Check the sample of matching keys the dialog lists.
  4. Choose Delete 30 keys. Querybara deletes them with UNLINK in batches, with a progress bar.
  5. The dialog reports “Deleted 30 keys”. Choose Close.

Cancel stops a count or a deletion; the dialog says how many keys were deleted before it stopped. In Cluster mode the bulk delete covers every primary. Keys the ACL user may not delete are reported as refused.

querybara query runs the same commands, so you can script TTL changes:

Terminal window
querybara query "redis://cache.example.com:6379/0" -e 'EXPIRE session:4f2a 3600'

Destructive commands such as DEL, UNLINK and RENAME ask for confirmation in a terminal, or need --yes.

Documents Querybara 0.1.1 · built frombc9f5aa