]> granicus.if.org Git - pdns/commitdiff
oops
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 26 Jan 2004 18:49:19 +0000 (18:49 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 26 Jan 2004 18:49:19 +0000 (18:49 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@223 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/recursor_cache.hh [new file with mode: 0644]

diff --git a/pdns/recursor_cache.hh b/pdns/recursor_cache.hh
new file mode 100644 (file)
index 0000000..eac3335
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef RECURSOR_CACHE_HH
+#define RECURSOR_CACHE_HH
+#include <map>
+#include <string>
+#include <set>
+#include "dns.hh"
+#include "qtype.hh"
+
+
+class RecursorCache
+{
+public:
+  virtual unsigned int size()=0;
+  virtual int get(const string &qname, const QType& qt, set<DNSResourceRecord>* res)=0;
+  virtual void replace(const string &qname, const QType& qt,  const set<DNSResourceRecord>& content)=0;
+  virtual void doPrune(void)=0;
+  int cacheHits, cacheMisses;
+
+};
+
+
+class MemRecursorCache : public RecursorCache
+{
+public:
+  virtual ~MemRecursorCache(){}
+  virtual unsigned int size();
+  virtual int get(const string &qname, const QType& qt, set<DNSResourceRecord>* res);
+  virtual void replace(const string &qname, const QType& qt,  const set<DNSResourceRecord>& content);
+  virtual void doPrune(void);
+private:
+  typedef map<string,set<DNSResourceRecord> > cache_t;
+
+  cache_t d_cache;
+};
+
+
+#endif