cache | memory safe async | Cell 14 | Search

Run example

npm run import -- "refresh regular cache"

refresh regular cache


function refreshCache(cache, allIds) {
    var cacheIds = cache.map(e => e[1])
    
    // add files that don't exist
    var missing = allIds.filter(n => !cacheIds.includes(n))
    if(missing.length > 0) {
        return missing[0]
    }
    
    // TODO: update any changed notebooks first
    
    // update the oldest record
    cache.sort((a, b) => a[0] - b[0])
    return cache[0][1]
}


module.exports = {
    refreshCache
}