Reputation: 14490
We have this web app we're working on where users store some bookmarks (url/title/shortkey/times url clicked) etc.
Every time the user refreshes the page, this data is being retrieved from the database (different server). Logically, so you're able to view the bookmarks. All the bookmarks are in the of every page of the app; so where every the user clicks, those data has to be parsed.
Is it better to store this data into Sessions or keep requesting every time from the database? What do developers usually do in this situations?
I would imagine, every refresh button from approximately 1000 users with approximately 100 bookmarks (approx. 100 characters each row), thats a ton of data every minute to be accessed.
A pretty similar example based on our web app is the twitter's favourites. Every time you access this page, does it request's your favourites from the database, or are the favourites stored into sessions based on your ID?
Upvotes: 0
Views: 93
Reputation: 6573
Cache the bookmarks to a flat file to include where relevant (even the structured nature if you let them build a folder structure) - if you store the bookmarks in a db then you can reconstitue from those results. Simply delete the file when they CRUD any bookmark.
If you come up with a suitable file naming scheme - like userId.txt - managing will be easy.
Upvotes: 1