Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::NarCache Class Reference

#include <nar-cache.hh>

Public Member Functions

 NarCache (std::optional< std::filesystem::path > cacheDir={})
ref< SourceAccessor > getOrInsert (const Hash &narHash, fun< void(Sink &)> populate)

Detailed Description

A cache for NAR accessors with optional disk caching.

Constructor & Destructor Documentation

◆ NarCache()

nix::NarCache::NarCache ( std::optional< std::filesystem::path > cacheDir = {})

Create a NAR cache with an optional cache directory for disk storage.

Member Function Documentation

◆ getOrInsert()

ref< SourceAccessor > nix::NarCache::getOrInsert ( const Hash & narHash,
fun< void(Sink &)> populate )

Lookup or create a NAR accessor, optionally using disk cache.

Parameters
narHashThe NAR hash to use as cache key
populateFunction called with a Sink to populate the NAR if not cached
Returns
The cached or newly created accessor

The documentation for this class was generated from the following files:
  • libutil/include/nix/util/nar-cache.hh
  • libutil/nar-cache.cc