Rose
|
A cache with a source on the World Wide Web, and local store on the filesystem. More...
#include <Cache.h>
Public Member Functions | |
WebFileCache (const std::string &sourceURI, const std::filesystem::path &rootPath, const std::string &cacheName) | |
Constructor. More... | |
WebFileCache (const std::string &sourceURI, const std::filesystem::path &rootPath, const std::string &cacheName, std::chrono::system_clock::duration cacheValidityDuration) | |
Constructor. More... | |
void | connect (Signal< int > &futureCheck, Signal< int > &validityCheck) |
Connect the WebFileCache to signals to trigger regular data checks. More... | |
operator bool () const | |
Determine local store validity. | |
auto | cacheRootPath () const |
Get the Cache root path. More... | |
void | fetchAll () |
Attempt to fetch all expired or not yet fetched objects. | |
![]() | |
template<typename S > | |
std::optional< uint32_t > | findByUserName (S userName) |
Public Attributes | |
Signal< uint32_t > | itemFetched {} |
Signal to transmit when a cache object is fetched. | |
Protected Member Functions | |
void | checkFutures () |
Check for completed futures and process. | |
Static Protected Member Functions | |
static uint32_t | asyncFetch (WebFileCache *self, uint32_t id, time_t cacheTime) |
A std::async capable method of fetching a single CacheObject. More... | |
Protected Attributes | |
SignalSerialNumber | mSignalSerialNumber {} |
The signal serial number for this object. | |
std::mutex | mMutex |
Mutex for locking the WebFileCache. | |
std::shared_ptr< Slot< int > > | mCheckValidity |
Slot for check validity timing signal. | |
std::shared_ptr< Slot< int > > | mCheckFutures |
Slot for check futures timeing signal. | |
std::vector< std::future< uint32_t > > | mFutureList |
The list of outstanding futures. | |
![]() | |
std::unique_ptr< CacheLocalStore > | localStore |
The local store for the Cache. | |
std::unique_ptr< CacheSource > | source |
The source for cache objects. | |
A cache with a source on the World Wide Web, and local store on the filesystem.
rose::WebFileCache::WebFileCache | ( | const std::string & | sourceURI, |
const std::filesystem::path & | rootPath, | ||
const std::string & | cacheName | ||
) |
Constructor.
See: CacheWebSource and CacheFileSystem
sourceURI | The source URI to initialize the cache source. |
rootPath | The filesystem root path to initialize the local store. |
cacheName | The cache name to initialize the local store. |
rose::WebFileCache::WebFileCache | ( | const std::string & | sourceURI, |
const std::filesystem::path & | rootPath, | ||
const std::string & | cacheName, | ||
std::chrono::system_clock::duration | cacheValidityDuration | ||
) |
Constructor.
See: CacheWebSource and CacheFileSystem
sourceURI | The source URI to initialize the cache source. |
rootPath | The filesystem root path to initialize the local store. |
cacheName | The cache name to initialize the local store. |
cacheValidityDuration | The duration cache objects should be considered valid for. |
|
staticprotected |
A std::async capable method of fetching a single CacheObject.
self | A pointer to the WebFileCache (this). |
id | The identifier of the CacheObject |
cacheTime | The cache time of the object. |
|
inline |
Get the Cache root path.
Connect the WebFileCache to signals to trigger regular data checks.
futureCheck | The signal used to time checks for completed asynchronous fetches. |
validityCheck | The signal used to time checks for cache object validity. |