ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
colmap::ThreadSafeLRUCache< key_t, value_t > Class Template Reference

#include <cache.h>

Collaboration diagram for colmap::ThreadSafeLRUCache< key_t, value_t >:

Classes

struct  Entry
 

Public Types

using LoadFn = std::function< std::shared_ptr< value_t >(const key_t &)>
 

Public Member Functions

 ThreadSafeLRUCache (size_t max_num_elems, LoadFn load_fn)
 
size_t NumElems () const
 
size_t MaxNumElems () const
 
bool Exists (const key_t &key) const
 
std::shared_ptr< value_t > Get (const key_t &key)
 
bool Evict (const key_t &key)
 
void Pop ()
 
void Clear ()
 

Protected Attributes

const LoadFn load_fn_
 
std::shared_mutex cache_mutex_
 
LRUCache< key_t, Entrycache_
 

Detailed Description

template<typename key_t, typename value_t>
class colmap::ThreadSafeLRUCache< key_t, value_t >

Definition at line 71 of file cache.h.

Member Typedef Documentation

◆ LoadFn

template<typename key_t , typename value_t >
using colmap::ThreadSafeLRUCache< key_t, value_t >::LoadFn = std::function<std::shared_ptr<value_t>(const key_t&)>

Definition at line 73 of file cache.h.

Constructor & Destructor Documentation

◆ ThreadSafeLRUCache()

template<typename key_t , typename value_t >
colmap::ThreadSafeLRUCache< key_t, value_t >::ThreadSafeLRUCache ( size_t  max_num_elems,
LoadFn  load_fn 
)

Definition at line 243 of file cache.h.

Member Function Documentation

◆ Clear()

template<typename key_t , typename value_t >
void colmap::ThreadSafeLRUCache< key_t, value_t >::Clear

Definition at line 316 of file cache.h.

◆ Evict()

template<typename key_t , typename value_t >
bool colmap::ThreadSafeLRUCache< key_t, value_t >::Evict ( const key_t &  key)

Definition at line 304 of file cache.h.

◆ Exists()

template<typename key_t , typename value_t >
bool colmap::ThreadSafeLRUCache< key_t, value_t >::Exists ( const key_t &  key) const

Definition at line 264 of file cache.h.

◆ Get()

template<typename key_t , typename value_t >
std::shared_ptr< value_t > colmap::ThreadSafeLRUCache< key_t, value_t >::Get ( const key_t &  key)

Definition at line 270 of file cache.h.

◆ MaxNumElems()

template<typename key_t , typename value_t >
size_t colmap::ThreadSafeLRUCache< key_t, value_t >::MaxNumElems

Definition at line 258 of file cache.h.

◆ NumElems()

template<typename key_t , typename value_t >
size_t colmap::ThreadSafeLRUCache< key_t, value_t >::NumElems

Definition at line 252 of file cache.h.

◆ Pop()

template<typename key_t , typename value_t >
void colmap::ThreadSafeLRUCache< key_t, value_t >::Pop

Definition at line 310 of file cache.h.

Member Data Documentation

◆ cache_

template<typename key_t , typename value_t >
LRUCache<key_t, Entry> colmap::ThreadSafeLRUCache< key_t, value_t >::cache_
protected

Definition at line 110 of file cache.h.

◆ cache_mutex_

template<typename key_t , typename value_t >
std::shared_mutex colmap::ThreadSafeLRUCache< key_t, value_t >::cache_mutex_
mutableprotected

Definition at line 109 of file cache.h.

◆ load_fn_

template<typename key_t , typename value_t >
const LoadFn colmap::ThreadSafeLRUCache< key_t, value_t >::load_fn_
protected

Definition at line 107 of file cache.h.


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