clang-tools 20.0.0git
Protected Member Functions | List of all members
clang::clangd::FileCache Class Reference

Base class for threadsafe cache of data read from a file on disk. More...

#include <FileCache.h>

Inheritance diagram for clang::clangd::FileCache:
Inheritance graph
[legend]

Protected Member Functions

 FileCache (PathRef Path)
 
void read (const ThreadsafeFS &TFS, std::chrono::steady_clock::time_point FreshTime, llvm::function_ref< void(std::optional< llvm::StringRef >)> Parse, llvm::function_ref< void()> Read) const
 
PathRef path () const
 

Detailed Description

Base class for threadsafe cache of data read from a file on disk.

We want configuration files to be "live" as much as possible. Reading them every time is simplest, but caching solves a few problems:

We still read and parse the data synchronously on demand, but skip as much work as possible:

Caches for particular data (e.g. compilation databases) should inherit and:

Definition at line 40 of file FileCache.h.

Constructor & Destructor Documentation

◆ FileCache()

clang::clangd::FileCache::FileCache ( PathRef  Path)
protected

Definition at line 25 of file FileCache.cpp.

Member Function Documentation

◆ path()

PathRef clang::clangd::FileCache::path ( ) const
inlineprotected

Definition at line 63 of file FileCache.h.

Referenced by clang::clangd::config::FileConfigCache::get().

◆ read()

void clang::clangd::FileCache::read ( const ThreadsafeFS TFS,
std::chrono::steady_clock::time_point  FreshTime,
llvm::function_ref< void(std::optional< llvm::StringRef >)>  Parse,
llvm::function_ref< void()>  Read 
) const
protected

The documentation for this class was generated from the following files: