Introduce a non-blocking cache invalidation algorithm
Introduce a non-blocking cache invalidation algorithm

0. let synchronous be true
1. check if item is in store
2. if in store, check ttl
    2.1 let requireRefresh be false
    2.2 let refreshInProgress be false
    2.3 if expired, let requireRefresh be true
    2.4 if refreshInProgress is true
        2.4.1 return existing data; go to 3.
    2.5 let refreshInProgress be true
    2.6 let synchronous be false
    2.7 return existing data
3. obtain new data, in background if synchronous is false
3.1 insert new data into cache
3.2 let requireRefresh be false
3.3 let refreshInProgress be false
3.4 return new data if synchronous is true

officialpsychonautwiki/bifrost,psychonautwiki/bifrost