vbrandl / hoc

Generate Hits-of-Code badges for GitHub repositories

Home Page:https://hitsofcode.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement some form of caching

vbrandl opened this issue · comments

A simple form of caching might look like this:

When calculating the HoC, store the current commit ref OLD_HEAD and the HoC score somewhere. Once a new request is made, perform a pull operation, compare OLD_HEAD against the current HEAD. If they are the same, return the cached value, if not, calculate the HoC score between OLD_HEAD and the current HEAD, add the previously cached value and store the new result in the cache.