Files cache.
More...
#include <Cache.h>
|
CacheResultCodes | addCache (const std::filesystem::path &filePath, std::ios_base::openmode mode) |
| Add cache data.
|
|
CacheResultCodes | appendCache (const std::filesystem::path &filePath, const std::vector< char > &data) |
| Append specific cache.
|
|
CacheResultCodes | appendCache (const std::filesystem::path &filePath, std::string_view data) |
| Append specific cache.
|
|
bool | contains (const std::filesystem::path &filePath) const |
| Check if file data is cached.
|
|
void | clear () |
| Clear all cache.
|
|
void | clear (const std::filesystem::path &filePath) |
| Clear cache of specific file.
|
|
void | setCacheSize (uint64_t sizeInBytes) |
| Set cache size.
|
|
const std::string & | getCacheData (const std::filesystem::path &filePath) const |
| Get cached data.
|
|
uint64_t | getCacheSize () const |
| Get global cache size.
|
|
uint64_t | getCurrentCacheSize () const |
| Used cache size.
|
|
const std::string & | operator[] (const std::filesystem::path &filePath) const |
| Get cached data.
|
|
|
class | FileManager |
|
void | _utility::addCache (std::filesystem::path &&filePath, std::string &&data) |
|
template<template< typename > typename OperationT>
requires _utility::Operation<OperationT<uint64_t>> |
void | _utility::changeCurrentCacheSize (uint64_t amount) |
|
Files cache.
Definition at line 18 of file Cache.h.
◆ CacheResultCodes
Result of adding cache.
Definition at line 22 of file Cache.h.
◆ addCache()
Cache::CacheResultCodes file_manager::Cache::addCache |
( |
const std::filesystem::path & | filePath, |
|
|
std::ios_base::openmode | mode ) |
Add cache data.
- Parameters
-
- Returns
- Error code from Cache::CacheErrorCodes
Definition at line 73 of file Cache.cpp.
◆ appendCache() [1/2]
CacheResultCodes file_manager::Cache::appendCache |
( |
const std::filesystem::path & | filePath, |
|
|
const std::vector< char > & | data ) |
Append specific cache.
- Parameters
-
filePath | Path to file |
data | Cache data |
- Returns
- Error code from Cache::CacheErrorCodes
◆ appendCache() [2/2]
CacheResultCodes file_manager::Cache::appendCache |
( |
const std::filesystem::path & | filePath, |
|
|
std::string_view | data ) |
Append specific cache.
- Parameters
-
filePath | Path to file |
data | Cache data |
- Returns
- Error code from Cache::CacheErrorCodes
◆ clear() [1/2]
void file_manager::Cache::clear |
( |
| ) |
|
◆ clear() [2/2]
void file_manager::Cache::clear |
( |
const std::filesystem::path & | filePath | ) |
|
Clear cache of specific file.
- Parameters
-
◆ contains()
bool file_manager::Cache::contains |
( |
const std::filesystem::path & | filePath | ) |
const |
Check if file data is cached.
- Parameters
-
- Returns
- Returns true if file is already cached
Definition at line 128 of file Cache.cpp.
◆ getCacheData()
const string & file_manager::Cache::getCacheData |
( |
const std::filesystem::path & | filePath | ) |
const |
Get cached data.
- Returns
- Cached data
- Exceptions
-
FileDoesNotExistException | |
Definition at line 169 of file Cache.cpp.
◆ getCacheSize()
uint64_t file_manager::Cache::getCacheSize |
( |
| ) |
const |
Get global cache size.
- Returns
- Cache size in bytes
Definition at line 182 of file Cache.cpp.
◆ getCurrentCacheSize()
uint64_t file_manager::Cache::getCurrentCacheSize |
( |
| ) |
const |
Used cache size.
- Returns
- Cache size in bytes
Definition at line 187 of file Cache.cpp.
◆ operator[]()
const string & file_manager::Cache::operator[] |
( |
const std::filesystem::path & | filePath | ) |
const |
Get cached data.
- Returns
- Cached data
- Exceptions
-
FileDoesNotExistException | |
Definition at line 192 of file Cache.cpp.
◆ setCacheSize()
void file_manager::Cache::setCacheSize |
( |
uint64_t | sizeInBytes | ) |
|
Set cache size.
- Parameters
-
Definition at line 159 of file Cache.cpp.
◆ FileManager
The documentation for this class was generated from the following files: