00001 00006 #ifndef CACHE_H_ 00007 #define CACHE_H_ 00008 00009 #include <string> 00010 #include <map> 00011 #include <ctime> 00012 00013 #include "Settings.h" 00014 #include "User.h" 00015 #include "Logger.h" 00016 #include "GarbageCollector.h" 00017 #include "exceptions.h" 00018 00019 using namespace std; 00020 00024 #define SINGLE_USER "single user" 00025 00029 #define SINGLE_SPACE "single space" 00030 00031 class User; 00032 class GarbageCollector; 00033 00040 class Cache { 00041 00042 public: 00043 00047 Settings config; 00048 00052 Logger logger; 00053 00057 GarbageCollector * gc; 00058 00062 static const unsigned int MAX_OBJECT_SIZE = 1024 * 1024; 00063 00064 00065 00066 private: 00067 map<string, User *> users; 00068 00069 public: 00070 00085 Cache(const string & configurationDirectory) throw (Exception); 00086 00092 virtual ~Cache(); 00093 00103 void reloadConfig(const string& configurationDirectory); 00104 00112 User * login(const string& name); 00113 00119 static time_t getCurrentTime() { 00120 return time(0); 00121 } 00122 00123 private: 00124 00134 void loadConfFile(const string& confFilename) throw (Exception); 00135 00145 void loadUserConfFile(const string& confFilename) throw (Exception); 00146 }; 00147 00148 #endif /* CACHE_H_ */