~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/qcache.h

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/*
 
2
 -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
3
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
 
4
 
4
5
 *  Definitions required for Query Cache plugin
5
 
 *
6
 
 *  Copyright (C) 2008 Sun Microsystems, Toru Maesaka
 
6
 
 
7
 *  Copyright (C) 2008 Mark Atwood, Toru Maesaka
7
8
 *
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
24
25
 
25
 
#include "drizzled/plugin/plugin.h"
26
 
 
27
 
namespace drizzled
28
 
{
29
 
class Session;
30
 
 
31
 
namespace plugin
32
 
{
33
 
 
34
26
/* 
35
27
  This is the API that a qcache plugin must implement.
36
28
  it should implement each of these function pointers.
40
32
    false = success
41
33
    true  = failure
42
34
*/
43
 
class QueryCache : public Plugin
 
35
class QueryCache
44
36
{
45
 
  QueryCache();
46
 
  QueryCache(const QueryCache &);
47
 
  QueryCache& operator=(const QueryCache &);
 
37
  std::string name;
48
38
public:
49
 
  explicit QueryCache(std::string name_arg)
50
 
    : Plugin(name_arg, "QueryCache")
51
 
  {}
 
39
  QueryCache(std::string name_arg): name(name_arg) {}
 
40
  QueryCache(const char *name_arg): name(name_arg) {}
 
41
 
 
42
  std::string getName() { return name; }
52
43
 
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;
57
48
 
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;
63
 
 
64
 
  static bool addPlugin(QueryCache *handler);
65
 
  static void removePlugin(QueryCache *handler);
66
 
 
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,
72
 
                            bool transactional);
73
 
  static bool flushDo(Session *session);
74
54
};
75
55
 
76
 
} /* namespace plugin */
77
 
} /* namespace drizzled */
78
 
 
79
56
#endif /* DRIZZLED_PLUGIN_QUERY_CACHE_H */