holmes-app / holmes-api

API for holmes website validation.
MIT License
17 stars 7 forks source link

Cache counts in redis #26

Closed heynemann closed 10 years ago

heynemann commented 10 years ago

Create redis counters for:

The general rule here is:

1) Whenever the key is read, if it's not found then read it from the database and populate the key in redis; 2) Whenever a new page is created for the domain, increment the page-count counter; 3) Whenever a new review is created for a domain: 3.1) If the domain already had an active review, do NOT increment the counter for active reviews, but increment the violation-count and violation-points by the DELTA between the active review and the current one (might be a negative increment); 3.2) If the domain did NOT have an active review, increment the counter for active reviews and the counter for violation count and violation points.

If any of the counters do not exist previously, populate them as in 1).