mirror of
https://github.com/NixOS/nix
synced 2025-07-02 13:31:48 +02:00
nix-daemon: Disable path info cache
This is useless because the client also caches path info, and can cause problems for long-running clients like hydra-queue-runner (i.e. it may return cached info about paths that have been garbage-collected).
This commit is contained in:
parent
8decb07c31
commit
256940fc48
5 changed files with 17 additions and 5 deletions
|
@ -11,7 +11,7 @@ class LRUCache
|
|||
{
|
||||
private:
|
||||
|
||||
size_t maxSize;
|
||||
size_t capacity;
|
||||
|
||||
// Stupid wrapper to get around circular dependency between Data
|
||||
// and LRU.
|
||||
|
@ -27,14 +27,16 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
LRUCache(size_t maxSize) : maxSize(maxSize) { }
|
||||
LRUCache(size_t capacity) : capacity(capacity) { }
|
||||
|
||||
/* Insert or upsert an item in the cache. */
|
||||
void upsert(const Key & key, const Value & value)
|
||||
{
|
||||
if (capacity == 0) return;
|
||||
|
||||
erase(key);
|
||||
|
||||
if (data.size() >= maxSize) {
|
||||
if (data.size() >= capacity) {
|
||||
/* Retire the oldest item. */
|
||||
auto oldest = lru.begin();
|
||||
data.erase(*oldest);
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
|
||||
Sync() { }
|
||||
Sync(const T & data) : data(data) { }
|
||||
Sync(T && data) noexcept : data(std::move(data)) { }
|
||||
|
||||
class Lock
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue