Skip to content

Commit

Permalink
added devnull cache adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
janpieper committed Feb 3, 2015
1 parent 52dfca3 commit 7b63a72
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
38 changes: 38 additions & 0 deletions devnulladapter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "devnulladapter.hpp"

using namespace Bidstack::Cache;

DevNullAdapter::DevNullAdapter(QObject *parent) : AbstractAdapter(parent) {

}

bool DevNullAdapter::store(QString key, QString data) {
Q_UNUSED(key);
Q_UNUSED(data);
return true;
}

bool DevNullAdapter::has(QString key) {
Q_UNUSED(key);
return false;
}

bool DevNullAdapter::remove(QString key) {
Q_UNUSED(key);
return true;
}

bool DevNullAdapter::clear() {
return true;
}

QString DevNullAdapter::fetch(QString key) {
Q_UNUSED(key);
return "";
}

QString DevNullAdapter::fetch(QString key, QString defaultValue) {
Q_UNUSED(key);
Q_UNUSED(defaultValue);
return defaultValue;
}
29 changes: 29 additions & 0 deletions devnulladapter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef BIDSTACK_CACHE_DEVNULLADAPTER_HPP
#define BIDSTACK_CACHE_DEVNULLADAPTER_HPP

#include <QObject>

#include "abstractadapter.hpp"

namespace Bidstack {
namespace Cache {

class DevNullAdapter : public AbstractAdapter {
Q_OBJECT

public:
DevNullAdapter(QObject *parent = 0);

public:
bool store(QString key, QString data);
bool has(QString key);
bool remove(QString key);
bool clear();
QString fetch(QString key);
QString fetch(QString key, QString defaultValue);
};

};
};

#endif

0 comments on commit 7b63a72

Please sign in to comment.