Skip to main content

Get Expired Range

Returns an array of keys that have expired between the given start and end dates.

  • Parameters:
    • start: The start date or timestamp.
    • end: The end date or timestamp.
    • pattern: Optional pattern to match against the keys.
  • Returns:
    • The result of the operation, includes an array of keys that match the pattern or an error if the operation failed.
// Get the expired keys between two dates
const result = db.expiredRange(new Date("2023-01-01"), new Date("2023-01-31"));

if (result.success) {
console.log(result.data);
} else {
console.error(result.error);
}