xgboost
|
DMatrix 相关数据的线程安全 FIFO 缓存。更多...
#include <cache.h>
类 | |
struct | Hash |
struct | Item |
struct | Key |
公共成员函数 | |
DMatrixCache (std::size_t cache_size) | |
DMatrixCache & | operator= (DMatrixCache &&that) |
template<typename... Args> | |
std::shared_ptr< CacheT > | CacheItem (std::shared_ptr< DMatrix > m, Args const &... args) |
如果新的 DMatrix 尚未在缓存中,则对其进行缓存。更多... | |
template<typename... Args> | |
std::shared_ptr< CacheT > | ResetItem (std::shared_ptr< DMatrix > m, Args const &... args) |
重新初始化缓存中的条目。更多... | |
decltype(container_) const & | Container () |
获取底层哈希映射的 const 引用。在返回之前清除已过期的缓存。更多... | |
std::shared_ptr< CacheT > | Entry (DMatrix const *m) const |
静态公共成员函数 | |
static constexpr std::size_t | DefaultSize () |
保护成员函数 | |
void | CheckConsistent () const |
void | ClearExpired () |
void | ClearExcess () |
保护属性 | |
std::unordered_map< Key, Item, Hash > | container_ |
std::queue< Key > | queue_ |
std::size_t | max_size_ |
DMatrix 相关数据的线程安全 FIFO 缓存。
CacheT | 需要缓存的类型。 |
|
inlineexplicit |
cache_size | 缓存的最大大小。 |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
获取底层哈希映射的 const 引用。在返回之前清除已过期的缓存。
|
inlinestaticconstexpr |
|
inline |
|
inline |
|
inline |
重新初始化缓存中的条目。
由于使用 shared_ptr 来持有条目,因此缓存外部的任何引用都无法再从缓存中访问。
我们使用 reset 而不是 erase 来避免遍历整个缓存来更新单个条目。(缓存是 FIFO,需要维护顺序)。
|
protected |
|
protected |
|
protected |