From 501bac50016628b787906392ce7af8262e561e52 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 29 Dec 2009 01:11:27 +0000 Subject: Ok, cache stuff is in, and that's good, now we have to use it. --- src/cache.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/cache.cpp (limited to 'src/cache.cpp') diff --git a/src/cache.cpp b/src/cache.cpp new file mode 100644 index 0000000..1646d0a --- /dev/null +++ b/src/cache.cpp @@ -0,0 +1,39 @@ +#include "cache.h" +#include +#include + +Cache::Cache() : + bIsLoaded( false ) +{ +} + +Cache::~Cache() +{ +} + +void Cache::bind( const Bu::FString &sCacheFile ) +{ + this->sCacheFile = sCacheFile; + load(); +} + +void Cache::load() +{ + if( bIsLoaded ) + return; + Bu::File fIn( sCacheFile, Bu::File::Read ); + Bu::Archive ar( fIn, Bu::Archive::load ); + + ar >> hRequires >> hVariables; + + bIsLoaded = true; +} + +void Cache::save() +{ + Bu::File fIn( sCacheFile, Bu::File::WriteNew ); + Bu::Archive ar( fIn, Bu::Archive::save ); + + ar << hRequires << hVariables; +} + -- cgit v1.2.3