nox
nox copied to clipboard
Nox unnecessarily invalidates cache
Nox's cache expires after 1 hour, regardless of if any expressions in the underlying nix channel have changed (this section of cache.py:).
region = make_region().configure(
'dogpile.cache.dbm',
expiration_time=3600,
arguments={'filename': '/tmp/nox.dbm.'+getpass.getuser()}
)
As most nix channels are also git repositories, the HEAD commit's hash & status of the containing repo could be used to check the validity of the cache. At the very least this would stop the re-evaluation of the nixpkgs repo, which is likely the largest time sink for most users.
In the case of a non-git nix channel, a 1 hour cache timeout could be used as a fallback.
https://github.com/madjar/nox/pull/60 I've taken this approach for myself.
I would still like a more intelligent cache invalidation as described in OP.