1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Definitions required for Query Cache plugin
6
* Copyright (C) 2008 Sun Microsystems, Toru Maesaka
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; version 2 of the License.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H
23
#define DRIZZLED_PLUGIN_QUERY_CACHE_H
25
#include "drizzled/plugin/plugin.h"
35
This is the API that a qcache plugin must implement.
36
it should implement each of these function pointers.
37
if a function pointer is NULL (not loaded), that's ok.
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")
53
virtual ~QueryCache() {}
54
/* Lookup the cache and transmit the data back to the client */
55
virtual bool tryFetchAndSend(Session *session,
56
bool is_transactional)= 0;
58
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;
62
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
#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */