QtWebApp
templatecache.h
1 #ifndef TEMPLATECACHE_H
2 #define TEMPLATECACHE_H
3 
4 #include <QCache>
5 #include "templateglobal.h"
6 #include "templateloader.h"
7 
8 namespace stefanfrings {
9 
44 class DECLSPEC TemplateCache : public TemplateLoader {
45  Q_OBJECT
46  Q_DISABLE_COPY(TemplateCache)
47 public:
48 
59  TemplateCache(const QSettings* settings, QObject* parent=nullptr);
60 
61 protected:
62 
68  virtual QString tryFile(const QString localizedName);
69 
70 private:
71 
72  struct CacheEntry {
73  QString document;
74  qint64 created;
75  };
76 
78  int cacheTimeout;
79 
81  QCache<QString,CacheEntry> cache;
82 
84  QMutex mutex;
85 };
86 
87 } // end of namespace
88 
89 #endif // TEMPLATECACHE_H
Caching template loader, reduces the amount of I/O and improves performance on remote file systems.
Definition: templatecache.h:44
Loads localized versions of template files.