Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce unnecessary DB access #1

Open
pawandubey opened this issue Nov 18, 2015 · 2 comments
Open

Reduce unnecessary DB access #1

pawandubey opened this issue Nov 18, 2015 · 2 comments

Comments

@pawandubey
Copy link

The same article is being fetched from the DB thrice if I do the following:

  1. View an article
  2. Like it
  3. Unlike it

Instead of making three DB calls here, reduce it to just one, and keep the article in memory while it is being viewed, and update the DB with the like/dislike count once the user leaves the page. This would reduce load on the server.

@pawandubey
Copy link
Author

Great work, BTW. It is a pretty good system, considering it is written from scratch. You are sanitizing the input and SQL queries, and are validating the stuff that needs to be validated. Really nice to see 👍

@bhargavkaranam
Copy link
Owner

Thank you for your inputs. Will work on converting the code to object oriented. Need to make a system so that a particular user cannot like/dislike an article more than once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants