aboutsummaryrefslogtreecommitdiff
path: root/oop2eindopdr/CacheManager.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-12-23 13:55:05 +0100
committerlonkaars <loek@pipeframe.xyz>2022-12-23 13:55:05 +0100
commit295ee857b9b46c27e80051700278e3075590d823 (patch)
tree276bbadb556312e8cf6981962ef1b341bb0d2010 /oop2eindopdr/CacheManager.h
parent9eb8aa6bab40bd58e70cb6124e462e1a3d47edb7 (diff)
WIP
Diffstat (limited to 'oop2eindopdr/CacheManager.h')
-rw-r--r--oop2eindopdr/CacheManager.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/oop2eindopdr/CacheManager.h b/oop2eindopdr/CacheManager.h
new file mode 100644
index 0000000..484871b
--- /dev/null
+++ b/oop2eindopdr/CacheManager.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#include <string>
+#include <vector>
+
+/** @brief cache storage manager */
+class CacheManager {
+private:
+ std::string cache_path; /** @brief currently opened cache location */
+ std::vector<std::fstream*> files;
+public:
+ /** @brief initialize CacheManager class at `cache_path` */
+ CacheManager(const char* cache_path);
+ CacheManager(std::string cache_path);
+ /** @brief close cache */
+ virtual ~CacheManager();
+ /** @brief create cache folder structure */
+ virtual void init_cache();
+ /** @brief update cache date */
+ virtual void update_cache();
+ /**
+ * @brief check cache file structure
+ *
+ * automatically updates chache if stale and/or creates cache when
+ * non-existant
+ */
+ virtual void verify_cache();
+
+ /** @brief get fstream for file in cache or create file */
+ virtual std::fstream* cache_get(const char* filename);
+
+ uint64_t age; /** @brief currently opened cache update unix timestamp */
+};
+