From 682ffd2b55aeb2fd22ef85cf36ccda551457e641 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Mon, 27 Jan 2025 18:55:19 -0500 Subject: [PATCH] Create PMLL.h The persistent memory logic loop Signed-off-by: J. K. Edwards --- PMLL.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 PMLL.h diff --git a/PMLL.h b/PMLL.h new file mode 100644 index 0000000..611d344 --- /dev/null +++ b/PMLL.h @@ -0,0 +1,29 @@ +#ifndef PMLL_H +#define PMLL_H + +#include +#include +#include +#include +#include + +class PMLL { +private: + std::unordered_map memory; // Key-value memory store + std::string memory_file; // File to store persistent memory + std::mutex memory_mutex; // Thread safety + + void loadMemory(); // Load memory from the file + void saveMemory(); // Save memory to the file + +public: + PMLL(const std::string& file_name); // Constructor + ~PMLL(); // Destructor + + void addMemory(const std::string& key, const std::string& value); // Add or update memory + std::string getMemory(const std::string& key) const; // Retrieve memory by key + void clearMemory(); // Clear all memory + void displayMemory() const; // Display all memory (debugging) +}; + +#endif // PMLL_H