1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
-*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
3
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
5
* Definitions required for Query Cache plugin
6
* Copyright (C) 2008 Sun Microsystems, Toru Maesaka
7
* Copyright (C) 2008 Mark Atwood, Toru Maesaka
8
9
* This program is free software; you can redistribute it and/or modify
9
10
* it under the terms of the GNU General Public License as published by
22
23
#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H
23
24
#define DRIZZLED_PLUGIN_QUERY_CACHE_H
25
#include "drizzled/plugin/plugin.h"
35
27
This is the API that a qcache plugin must implement.
36
28
it should implement each of these function pointers.
43
class QueryCache : public Plugin
46
QueryCache(const QueryCache &);
47
QueryCache& operator=(const QueryCache &);
49
explicit QueryCache(std::string name_arg)
50
: Plugin(name_arg, "QueryCache")
39
QueryCache(std::string name_arg): name(name_arg) {}
40
QueryCache(const char *name_arg): name(name_arg) {}
42
std::string getName() { return name; }
53
44
virtual ~QueryCache() {}
54
45
/* Lookup the cache and transmit the data back to the client */
55
virtual bool tryFetchAndSend(Session *session,
56
bool is_transactional)= 0;
46
virtual bool try_fetch_and_send(Session *session,
47
bool is_transactional)= 0;
58
49
virtual bool set(Session *session, bool is_transactional)= 0;
59
virtual bool invalidateTable(Session *session, bool is_transactional)= 0;
60
virtual bool invalidateDb(Session *session, const char *db_name,
61
bool transactional)= 0;
50
virtual bool invalidate_table(Session *session, bool is_transactional)= 0;
51
virtual bool invalidate_db(Session *session, const char *db_name,
52
bool transactional)= 0;
62
53
virtual bool flush(Session *session)= 0;
64
static bool addPlugin(QueryCache *handler);
65
static void removePlugin(QueryCache *handler);
67
/* These are the functions called by the rest of the Drizzle server */
68
static bool tryFetchAndSendDo(Session *session, bool transactional);
69
static bool setDo(Session *session, bool transactional);
70
static bool invalidateTableDo(Session *session, bool transactional);
71
static bool invalidateDbDo(Session *session, const char *db_name,
73
static bool flushDo(Session *session);
76
} /* namespace plugin */
77
} /* namespace drizzled */
79
56
#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */