I asked somewhat a similar question a while ago and this is one of the responses I got. My question was more to with how to make use a wait X amount of days before they could leave a review on my ecommerce store. Hopefully this will guide you in the right direction.
As I understand your use case, you need a persistent storage method to remember how many days have passed since a particular action/thing. There are, in general, 4 methods of persistent storage:
1. Cookies:
- Storage: Client Side
- Specific: Unique to user machine and domain
- Persistence Time: Can last forever unless the user specifically
deletes the cookie
- Common Use Cases: Saved preferences
2. Session
- Storage: Server Side (depends on driver)
- Specific: Specific to user (but depends on driver)
- Persistence Time: Usually expires in a couple of hours, but can be extended
- Common Use Cases: Persistence layer from one request to another (like shopping cart, popup notifications after action triggers)
3. Caching
- Storage: Server Side
- Specific: Generally application specific (but can be user specific)
- Persistence Time: Generally an hour to a couple of days
- Common Use Cases: Application specific storage use cases (e.g. total number of hits, most popular pages, database query caching, view caching)
4. Database
- Storage: Server Side
- Specific: Can be user or app specific
- Persistence Time: Forever until deleted
- Common Use Cases: Longer term data persistence layer (e.g. user details)