aboutsummaryrefslogtreecommitdiff
path: root/src/cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cache.cpp')
-rw-r--r--src/cache.cpp39
1 files changed, 39 insertions, 0 deletions
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 @@
1#include "cache.h"
2#include <bu/file.h>
3#include <bu/archive.h>
4
5Cache::Cache() :
6 bIsLoaded( false )
7{
8}
9
10Cache::~Cache()
11{
12}
13
14void Cache::bind( const Bu::FString &sCacheFile )
15{
16 this->sCacheFile = sCacheFile;
17 load();
18}
19
20void Cache::load()
21{
22 if( bIsLoaded )
23 return;
24 Bu::File fIn( sCacheFile, Bu::File::Read );
25 Bu::Archive ar( fIn, Bu::Archive::load );
26
27 ar >> hRequires >> hVariables;
28
29 bIsLoaded = true;
30}
31
32void Cache::save()
33{
34 Bu::File fIn( sCacheFile, Bu::File::WriteNew );
35 Bu::Archive ar( fIn, Bu::Archive::save );
36
37 ar << hRequires << hVariables;
38}
39