LLVM  8.0.1
Public Attributes | List of all members
llvm::CachePruningPolicy Struct Reference

Policy for the pruneCache() function. More...

#include "llvm/Support/CachePruning.h"

Collaboration diagram for llvm::CachePruningPolicy:
Collaboration graph
[legend]

Public Attributes

llvm::Optional< std::chrono::seconds > Interval = std::chrono::seconds(1200)
 The pruning interval. More...
 
std::chrono::seconds Expiration = std::chrono::hours(7 * 24)
 The expiration for a file. More...
 
unsigned MaxSizePercentageOfAvailableSpace = 75
 The maximum size for the cache directory, in terms of percentage of the available space on the disk. More...
 
uint64_t MaxSizeBytes = 0
 The maximum size for the cache directory in bytes. More...
 
uint64_t MaxSizeFiles = 1000000
 The maximum number of files in the cache directory. More...
 

Detailed Description

Policy for the pruneCache() function.

A default constructed CachePruningPolicy provides a reasonable default policy.

Definition at line 27 of file CachePruning.h.

Member Data Documentation

◆ Expiration

std::chrono::seconds llvm::CachePruningPolicy::Expiration = std::chrono::hours(7 * 24)

The expiration for a file.

When a file hasn't been accessed for Expiration seconds, it is removed from the cache. A value of 0 disables the expiration-based pruning.

Definition at line 37 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), and llvm::pruneCache().

◆ Interval

llvm::Optional<std::chrono::seconds> llvm::CachePruningPolicy::Interval = std::chrono::seconds(1200)

The pruning interval.

This is intended to be used to avoid scanning the directory too often. It does not impact the decision of which file to prune. A value of 0 forces the scan to occur. A value of None disables pruning.

Definition at line 32 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), and llvm::pruneCache().

◆ MaxSizeBytes

uint64_t llvm::CachePruningPolicy::MaxSizeBytes = 0

The maximum size for the cache directory in bytes.

A value over the amount of available space on the disk will be reduced to the amount of available space. A value of 0 disables the absolute size-based pruning.

Definition at line 49 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), and llvm::pruneCache().

◆ MaxSizeFiles

uint64_t llvm::CachePruningPolicy::MaxSizeFiles = 1000000

The maximum number of files in the cache directory.

A value of 0 disables the number of files based pruning.

This defaults to 1000000 because with that many files there are diminishing returns on the effectiveness of the cache. Some systems have a limit on total number of files, and some also limit the number of files per directory, such as Linux ext4, with the default setting (block size is 4096 and large_dir disabled), there is a per-directory entry limit of 508*510*floor(4096/(40+8))~=20M for average filename length of 40.

Definition at line 60 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), and llvm::pruneCache().

◆ MaxSizePercentageOfAvailableSpace

unsigned llvm::CachePruningPolicy::MaxSizePercentageOfAvailableSpace = 75

The maximum size for the cache directory, in terms of percentage of the available space on the disk.

Set to 100 to indicate no limit, 50 to indicate that the cache size will not be left over half the available disk space. A value over 100 will be reduced to 100. A value of 0 disables the percentage size-based pruning.

Definition at line 44 of file CachePruning.h.

Referenced by llvm::parseCachePruningPolicy(), and llvm::pruneCache().


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