Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
nix::fetchers::Cache Struct Referenceabstract

#include <cache.hh>

Inheritance diagram for nix::fetchers::Cache:
nix::fetchers::CacheImpl

Classes

struct  Result
 
struct  ResultWithStorePath
 

Public Types

using Domain = std::string_view
 
using Key = std::pair<Domain, Attrs>
 

Public Member Functions

virtual void upsert (const Key &key, const Attrs &value)=0
 
virtual std::optional< Attrslookup (const Key &key)=0
 
virtual std::optional< AttrslookupWithTTL (const Key &key)=0
 
virtual std::optional< ResultlookupExpired (const Key &key)=0
 
virtual void upsert (Key key, Store &store, Attrs value, const StorePath &storePath)=0
 
virtual std::optional< ResultWithStorePathlookupStorePath (Key key, Store &store)=0
 
virtual std::optional< ResultWithStorePathlookupStorePathWithTTL (Key key, Store &store)=0
 

Detailed Description

A cache for arbitrary Attrs -> Attrs mappings with a timestamp for expiration.

Member Typedef Documentation

◆ Domain

using nix::fetchers::Cache::Domain = std::string_view

A domain is a partition of the key/value cache for a particular purpose, e.g. git revision to revcount.

◆ Key

using nix::fetchers::Cache::Key = std::pair<Domain, Attrs>

A cache key is a domain and an arbitrary set of attributes.

Member Function Documentation

◆ lookup()

virtual std::optional< Attrs > nix::fetchers::Cache::lookup ( const Key & key)
pure virtual

Look up a key with infinite TTL.

Implemented in nix::fetchers::CacheImpl.

◆ lookupExpired()

virtual std::optional< Result > nix::fetchers::Cache::lookupExpired ( const Key & key)
pure virtual

Look up a key. Return a bool denoting whether its TTL has exceeded settings.tarballTTL.

Implemented in nix::fetchers::CacheImpl.

◆ lookupStorePath()

virtual std::optional< ResultWithStorePath > nix::fetchers::Cache::lookupStorePath ( Key key,
Store & store )
pure virtual

Look up a store path in the cache. The returned store path will be valid, but it may be expired.

Implemented in nix::fetchers::CacheImpl.

◆ lookupStorePathWithTTL()

virtual std::optional< ResultWithStorePath > nix::fetchers::Cache::lookupStorePathWithTTL ( Key key,
Store & store )
pure virtual

Look up a store path in the cache. Return nothing if its TTL has exceeded settings.tarballTTL.

Implemented in nix::fetchers::CacheImpl.

◆ lookupWithTTL()

virtual std::optional< Attrs > nix::fetchers::Cache::lookupWithTTL ( const Key & key)
pure virtual

Look up a key. Return nothing if its TTL has exceeded settings.tarballTTL.

Implemented in nix::fetchers::CacheImpl.

◆ upsert() [1/2]

virtual void nix::fetchers::Cache::upsert ( const Key & key,
const Attrs & value )
pure virtual

Add a key/value pair to the cache.

Implemented in nix::fetchers::CacheImpl.

◆ upsert() [2/2]

virtual void nix::fetchers::Cache::upsert ( Key key,
Store & store,
Attrs value,
const StorePath & storePath )
pure virtual

Insert a cache entry that has a store path associated with it. Such cache entries are always considered stale if the associated store path is invalid.

Implemented in nix::fetchers::CacheImpl.


The documentation for this struct was generated from the following file: