clang-tools  15.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(llvm::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 39 of file FileCache.h.

Constructor & Destructor Documentation

◆ FileCache()

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

Definition at line 24 of file FileCache.cpp.

Member Function Documentation

◆ path()

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

Definition at line 62 of file FileCache.h.

◆ read()

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

Definition at line 30 of file FileCache.cpp.


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