diff options
Diffstat (limited to 'project2/cache.cpp')
-rw-r--r-- | project2/cache.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/project2/cache.cpp b/project2/cache.cpp new file mode 100644 index 0000000..0db108b --- /dev/null +++ b/project2/cache.cpp @@ -0,0 +1,26 @@ +#include "cache.h" +#include "rowSet.h" +#include "rowProcessor.h" +#include "logger.h" + +Cache::Cache(const xmlpp::Element * p) : + SourceObject(p) +{ +} + +bool Cache::checkAndExecute(const Glib::ustring & n, const Glib::ustring & f, const RowProcessor * rp) +{ + RowSetCPtr cached = getCachedRowSet(n, f, rp); + if (cached) { + try { + Logger()->messagef(LOG_ERR, "Executing from cache"); + cached->execute(f, rp); + return true; + } + catch (...) { + Logger()->messagef(LOG_WARNING, "Cache failed"); + } + } + return false; +} + |