1 /***
2 * Copyright 2003-2010 Terracotta, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package net.sf.ehcache.store;
18
19 import net.sf.ehcache.CacheException;
20 import net.sf.ehcache.Element;
21 import net.sf.ehcache.Status;
22 import net.sf.ehcache.writer.CacheWriterManager;
23
24 import java.io.IOException;
25 import java.util.Collections;
26 import java.util.List;
27
28 /***
29 * A store implementation which does not store anything.
30 *
31 * @author Ludovic Orban
32 */
33 public final class NullStore extends AbstractStore implements TierableStore {
34
35 private NullStore() {
36 }
37
38 /***
39 * Create a new NullStore instance.
40 * @return a NullStore instance
41 */
42 public static NullStore create() {
43 return new NullStore();
44 }
45
46 /***
47 * {@inheritDoc}
48 */
49 public boolean put(Element element) throws CacheException {
50 return false;
51 }
52
53 /***
54 * {@inheritDoc}
55 */
56 public boolean putWithWriter(Element element, CacheWriterManager writerManager) throws CacheException {
57 return false;
58 }
59
60 /***
61 * {@inheritDoc}
62 */
63 public Element get(Object key) {
64 return null;
65 }
66
67 /***
68 * {@inheritDoc}
69 */
70 public Element getQuiet(Object key) {
71 return null;
72 }
73
74 /***
75 * {@inheritDoc}
76 */
77 public List getKeys() {
78 return Collections.emptyList();
79 }
80
81 /***
82 * {@inheritDoc}
83 */
84 public Element remove(Object key) {
85 return null;
86 }
87
88 /***
89 * {@inheritDoc}
90 */
91 public Element removeWithWriter(Object key, CacheWriterManager writerManager) throws CacheException {
92 return null;
93 }
94
95 /***
96 * {@inheritDoc}
97 */
98 public void removeAll() throws CacheException {
99 }
100
101 /***
102 * {@inheritDoc}
103 */
104 public Element putIfAbsent(Element element) throws NullPointerException {
105 return null;
106 }
107
108 /***
109 * {@inheritDoc}
110 */
111 public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException {
112 return null;
113 }
114
115 /***
116 * {@inheritDoc}
117 */
118 public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException {
119 return false;
120 }
121
122 /***
123 * {@inheritDoc}
124 */
125 public Element replace(Element element) throws NullPointerException {
126 return null;
127 }
128
129 /***
130 * {@inheritDoc}
131 */
132 public void dispose() {
133 }
134
135 /***
136 * {@inheritDoc}
137 */
138 public int getSize() {
139 return 0;
140 }
141
142 /***
143 * {@inheritDoc}
144 */
145 public int getInMemorySize() {
146 return 0;
147 }
148
149 /***
150 * {@inheritDoc}
151 */
152 public int getOffHeapSize() {
153 return 0;
154 }
155
156 /***
157 * {@inheritDoc}
158 */
159 public int getOnDiskSize() {
160 return 0;
161 }
162
163 /***
164 * {@inheritDoc}
165 */
166 public int getTerracottaClusteredSize() {
167 return 0;
168 }
169
170 /***
171 * {@inheritDoc}
172 */
173 public long getInMemorySizeInBytes() {
174 return 0;
175 }
176
177 /***
178 * {@inheritDoc}
179 */
180 public long getOffHeapSizeInBytes() {
181 return 0;
182 }
183
184 /***
185 * {@inheritDoc}
186 */
187 public long getOnDiskSizeInBytes() {
188 return 0;
189 }
190
191 /***
192 * {@inheritDoc}
193 */
194 public Status getStatus() {
195 return null;
196 }
197
198 /***
199 * {@inheritDoc}
200 */
201 public boolean containsKey(Object key) {
202 return false;
203 }
204
205 /***
206 * {@inheritDoc}
207 */
208 public boolean containsKeyOnDisk(Object key) {
209 return false;
210 }
211
212 /***
213 * {@inheritDoc}
214 */
215 public boolean containsKeyOffHeap(Object key) {
216 return false;
217 }
218
219 /***
220 * {@inheritDoc}
221 */
222 public boolean containsKeyInMemory(Object key) {
223 return false;
224 }
225
226 /***
227 * {@inheritDoc}
228 */
229 public void expireElements() {
230 }
231
232 /***
233 * {@inheritDoc}
234 */
235 public void flush() throws IOException {
236 }
237
238 /***
239 * {@inheritDoc}
240 */
241 public boolean bufferFull() {
242 return false;
243 }
244
245 /***
246 * {@inheritDoc}
247 */
248 public Policy getInMemoryEvictionPolicy() {
249 return null;
250 }
251
252 /***
253 * {@inheritDoc}
254 */
255 public void setInMemoryEvictionPolicy(Policy policy) {
256 }
257
258 /***
259 * {@inheritDoc}
260 */
261 public Object getInternalContext() {
262 return null;
263 }
264
265 /***
266 * {@inheritDoc}
267 */
268 public Object getMBean() {
269 return null;
270 }
271
272 /***
273 * {@inheritDoc}
274 */
275 public void fill(Element e) {
276
277 }
278 }