1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * querycache.h --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | *********************************************************************/
|
---|
25 |
|
---|
26 |
|
---|
27 | #ifndef QUERYCACHE_H
|
---|
28 | #define QUERYCACHE_H
|
---|
29 |
|
---|
30 |
|
---|
31 | #include "text_t.h"
|
---|
32 | #include "queryinfo.h"
|
---|
33 |
|
---|
34 | class resultcacheel
|
---|
35 | {
|
---|
36 | public:
|
---|
37 | resultcacheel ();
|
---|
38 |
|
---|
39 | int accessnum;
|
---|
40 | queryparamclass queryparameters;
|
---|
41 | queryresultsclass queryresults;
|
---|
42 | };
|
---|
43 |
|
---|
44 |
|
---|
45 | class querycache {
|
---|
46 | public:
|
---|
47 | querycache (int themaxcachesize);
|
---|
48 | ~querycache ();
|
---|
49 |
|
---|
50 | // returns true if the query was found in the cache
|
---|
51 | // if the query was found then queryresults contains
|
---|
52 | // the results
|
---|
53 | bool find (const queryparamclass &queryparams,
|
---|
54 | queryresultsclass &queryresults);
|
---|
55 |
|
---|
56 | void cache (const queryparamclass &queryparams,
|
---|
57 | const queryresultsclass &queryresults);
|
---|
58 |
|
---|
59 | protected:
|
---|
60 | resultcacheel *resultcache;
|
---|
61 |
|
---|
62 | int maxcachesize;
|
---|
63 | int nextaccessnum;
|
---|
64 |
|
---|
65 | int getnextaccessnum ();
|
---|
66 | int getfreecachenum ();
|
---|
67 | };
|
---|
68 |
|
---|
69 |
|
---|
70 | #endif
|
---|