3 ms·
Ask HN: How do you track user data?
I've found that there are 2 types of user's data:
the one that changes not often - user name, address, etc. and DB is the perfect place to store, search and update it,
and the other one that changes very frequently - recent requests history, menu and page state, etc. This type of data often has complex hierarchical structure (like tree control state) and can be updated very frequently. Do you use DB or some in-memory cache that is committed to the storage from time to time, are there any pitfalls that you've faced?
I'm thinking to use memory cache for this data and a daemon that commits this data to disk from time to time.
I've been using sessions (PHP sessions) to solve this task, but I plan to reject this approach for the following reasons:
1. want to have total control over user's data - storing, caching, protecting
2. want to share the data between multiple servers
Any ideas or advices?
- mdasen 18y agoFor #2: You simply need to change the session store in PHP. You can easily make PHP sessions database backed.