Page Count per Domain - key should be domain-name-page-count, like www.globo.com-page-count
Active Review Count per Domain - key should be domain-name-review-count, like www.globo.com-review-count
Number of Violations per Domain - key should be domain-name-violation-count, like www.globo.com-violation-count
Violation Points per Domain - key should be domain-name-violation-points, like www.globo.com-violation-points
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).
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).