KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > cache > result > ResultCacheDatabase


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
6  * Contact: sequoia@continuent.org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * Initial developer(s): Emmanuel Cecchet.
21  * Contributor(s): Nicolas Modrzyk.
22  */

23
24 package org.continuent.sequoia.controller.cache.result;
25
26 import org.continuent.sequoia.controller.cache.result.entries.AbstractResultCacheEntry;
27 import org.continuent.sequoia.controller.requests.AbstractRequest;
28 import org.continuent.sequoia.controller.requests.ParsingGranularities;
29 import org.continuent.sequoia.controller.requests.UpdateRequest;
30
31 /**
32  * This is a query cache implementation with a database granularity:
33  * <ul>
34  * <li><code>DATABASE</code>: the cache is flushed each time the database is
35  * updated (every INSERT, UPDATE, DELETE, ... statement).</li>
36  * </ul>
37  *
38  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
39  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
40  * @version 1.0
41  */

42
43 public class ResultCacheDatabase extends ResultCache
44 {
45
46   /**
47    * Builds a new ResultCache with a database granularity.
48    *
49    * @param maxEntries maximum number of entries
50    * @param pendingTimeout pending timeout for concurrent queries
51    */

52   public ResultCacheDatabase(int maxEntries, int pendingTimeout)
53   {
54     super(maxEntries, pendingTimeout);
55     parsingGranularity = ParsingGranularities.NO_PARSING;
56   }
57
58   /**
59    * @see org.continuent.sequoia.controller.cache.result.ResultCache#processAddToCache
60    */

61   protected void processAddToCache(AbstractResultCacheEntry qe)
62   {
63     return;
64   }
65
66   /**
67    * @see org.continuent.sequoia.controller.cache.result.AbstractResultCache#isUpdateNecessary(org.continuent.sequoia.controller.requests.UpdateRequest)
68    */

69   public boolean isUpdateNecessary(UpdateRequest request)
70   {
71     return true;
72   }
73
74   /**
75    * @see org.continuent.sequoia.controller.cache.result.ResultCache#processWriteNotify(org.continuent.sequoia.controller.requests.AbstractRequest)
76    */

77   protected void processWriteNotify(AbstractRequest request)
78   {
79     flushCache();
80   }
81
82   /**
83    * @see org.continuent.sequoia.controller.cache.result.ResultCache#getName()
84    */

85   public String JavaDoc getName()
86   {
87     return "database";
88   }
89
90 }
Popular Tags