1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems, Toru Maesaka
5
* Copyright (C) 2010 Djellel Eddine Difallah
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 2 of the License.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef DRIZZLED_PLUGIN_QUERY_CACHE_H
22
#define DRIZZLED_PLUGIN_QUERY_CACHE_H
24
#include <drizzled/plugin.h>
25
#include <drizzled/plugin/plugin.h>
26
#include <drizzled/sql_list.h>
28
#include <drizzled/visibility.h>
39
This is the API that a qcache plugin must implement.
42
class DRIZZLED_API QueryCache : public Plugin
47
QueryCache(const QueryCache &);
48
QueryCache& operator=(const QueryCache &);
52
explicit QueryCache(std::string name_arg)
53
: Plugin(name_arg, "QueryCache")
56
virtual ~QueryCache() {}
58
/* these are the Query Cache interface functions */
60
/* Lookup the cache and transmit the data back to the client */
61
virtual bool doIsCached(Session* session)= 0;
62
/* Lookup the cache and transmit the data back to the client */
63
virtual bool doSendCachedResultset(Session *session)= 0;
64
/* Send the current Resultset to the cache */
65
virtual bool doSetResultset(Session *session)= 0;
66
/* initiate a new Resultset (header) */
67
virtual bool doPrepareResultset(Session *session)= 0;
68
/* push a record to the current Resultset */
69
virtual bool doInsertRecord(Session *session, List<Item> &item)= 0;
71
static bool addPlugin(QueryCache *handler);
72
static void removePlugin(QueryCache *handler);
74
/* These are the functions called by the rest of the Drizzle server */
75
static bool isCached(Session *session);
76
static bool sendCachedResultset(Session *session);
77
static bool prepareResultset(Session *session);
78
static bool setResultset(Session *session);
79
static bool insertRecord(Session *session, List<Item> &item);
82
} /* namespace plugin */
83
} /* namespace drizzled */
85
#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */