class BuildCacheUtils {

    @VisibleForTesting
    static void deleteOldCacheEntries(
            @NonNull FileCache buildCache, @NonNull Duration cacheEntryLifeTime) {
        // There could be a race condition here if another thread/process also reaches this point,
        // but that is Okay because the method call below is thread-safe and process-safe, it's just
        // that the code below will be executed more than once (which is fine).
        buildCache.deleteOldCacheEntries(
                System.currentTimeMillis() - cacheEntryLifeTime.toMillis());
    }

}