Step 5 - Challenge: Implementing Key Expiry
Step 5 - Challenge: Implementing Key Expiry
Build Your Own Redis Server (Python Edition)
Step 1 - Introduction to RESP, Building a Protocol Handler Using Test-Driven Development
Step 1 - Introduction to RESP, Building a Protocol Handler Using Test-Driven Development
Step 2 - Creating a Network Client and Server
Step 2 - Creating a Network Client and Server
Step 4 - Handling Concurrency
Step 4 - Handling Concurrency
Step 5 - Implementing Expiry
Step 5 - Implementing Expiry
In this step your goal is to extend your support for the SET command so that you also accept the EX, PX EAXT PXAT expiry options. Refer to the SET command documentation for details of each option.
I strongly encourage you to automate the testing of these so you can set the values and get them both before and after the expiry to verify they are both set and expired correctly.
When you’re implementing your expiry think about how you can make it low overhead - Redis itself guarantees that expiry is a constant time operation.