diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2006-09-12 17:30:23 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2006-09-12 17:30:23 +0000 |
| commit | e2c430b237da5c0229fd8e0832eedc3b85045ec0 (patch) | |
| tree | 2f14481a9622c1d9ee913456f12ffb6cdfd53eef /src/cache.h | |
| parent | daa9ab77fa7ff88a77e028270ec32fa4f3e6d3bb (diff) | |
| download | build-e2c430b237da5c0229fd8e0832eedc3b85045ec0.tar.gz build-e2c430b237da5c0229fd8e0832eedc3b85045ec0.tar.bz2 build-e2c430b237da5c0229fd8e0832eedc3b85045ec0.tar.xz build-e2c430b237da5c0229fd8e0832eedc3b85045ec0.zip | |
Added cache functionality, which is really nice, things go much faster now.
Diffstat (limited to '')
| -rw-r--r-- | src/cache.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/cache.h b/src/cache.h new file mode 100644 index 0000000..944aa24 --- /dev/null +++ b/src/cache.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #ifndef CACHE_H | ||
| 2 | #define CACHE_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | #include <time.h> | ||
| 6 | #include "serializable.h" | ||
| 7 | #include <list> | ||
| 8 | #include <map> | ||
| 9 | #include <string> | ||
| 10 | |||
| 11 | class Cache : public Serializable | ||
| 12 | { | ||
| 13 | public: | ||
| 14 | Cache(); | ||
| 15 | virtual ~Cache(); | ||
| 16 | |||
| 17 | virtual void serialize( class Serializer &ar ); | ||
| 18 | |||
| 19 | class Entry | ||
| 20 | { | ||
| 21 | public: | ||
| 22 | int tCreated; | ||
| 23 | std::list<std::string> lData; | ||
| 24 | }; | ||
| 25 | |||
| 26 | Entry *get( const std::string &id ); | ||
| 27 | void put( const std::string &id, Entry *data ); | ||
| 28 | |||
| 29 | private: | ||
| 30 | std::map<std::string, Entry *> mCache; | ||
| 31 | }; | ||
| 32 | |||
| 33 | #endif | ||
