Initial commit.
[gobie.git] / qcache.h
blobfd99acb97fd00210f1ce3515fc87e55b2ebb1384
1 #include <QHash>
2 #include <QString>
3 #include <QTime>
5 template <class T>
6 struct QCacheEntry
8 QTime deletedAt;
9 unsigned refCount;
10 T t;
13 template <class T>
14 class QCache
16 QCashe();
17 ~QCache();
19 bool contains(const QString& key) const;
20 T& get(const QString& key);
21 void insert(const QString& key, const T& value);
22 int remove(const QString& key);
24 void purge(QTime& olderThan);
26 private:
27 QHash<QString, QCacheEntry<T> > pool;