I’ve created a model called Request, which is created when one user makes a request with another user. I’d like each request to only exist for 5 minutes. Is this possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Couple of ways to do this … you could add a Sweeper or delayed job to clear the values from the database periodically. Give each record a created_at, clear after 5 minutes.
Alternative would be to do this check when presenting the information to the user … similar idea, have a created_at, when you check the pending requests for the current user you ignore or delete any that are older than 5 minutes.