Setting the TTL (expire) using new Redis-OM & Node Object Mapping

Right now, Redis OM doesn't support setting the TTL as part of object mapping but I think it's a good idea and will put it in the backlog.

For now, you can set it manually using the Client.execute() method to call EXPIRE on the key containing the object you want to expire.

Details on the EXPIRE command are here but it's pretty much just EXPIRE key seconds.

They key for objects in Redis OM for Node.js is made up of the entity name and the entity ID separated by a colon. So, in your example, this would be something like Room:01FT4JWNQ2FJHQEVWXNRMWZ2QR.

Putting this together, here's the magic line of code:

await client.execute(['EXPIRE', `Room:${id}`, 3600]);