Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BaseStash |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2001-2004 The Apache Software Foundation | |
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 | package org.apache.commons.cache; | |
17 | ||
18 | import java.io.Serializable; | |
19 | ||
20 | /** | |
21 | * An abstract base {@link Stash} implementation, | |
22 | * mapping the non-serialized versions of | |
23 | * {@link #canStore} and {@link #store} to the | |
24 | * serialized ones, and declaring {@link #wantsSerializedForm} | |
25 | * to return <tt>false</tt>. | |
26 | * | |
27 | * @version $Id: BaseStash.java 155435 2005-02-26 13:17:27Z dirkv $ | |
28 | * @author Rodney Waldhoff | |
29 | */ | |
30 | 0 | public abstract class BaseStash implements Stash { |
31 | /** Equivalent to {@link #canStore(java.io.Serializable,java.io.Serializable,java.lang.Long,java.lang.Long,java.io.Serializable,byte[]) <tt>canStore(<i>key</i>,<i>val</i>,<i>expiresAt</i>,<i>cost</i>,<i>group</i>,null)</tt>)}. */ | |
32 | public int canStore(Serializable key, Serializable val, Long expiresAt, Long cost, Serializable group) { | |
33 | 0 | return canStore(key,val,expiresAt,cost,group,null); |
34 | } | |
35 | ||
36 | /** Equivalent to {@link #store(java.io.Serializable,java.io.Serializable,java.lang.Long,java.lang.Long,java.io.Serializable,byte[]) <tt>canStore(<i>key</i>,<i>val</i>,<i>expiresAt</i>,<i>cost</i>,<i>group</i>,null)</tt>)}. */ | |
37 | public boolean store(Serializable key, Serializable val, Long expiresAt, Long cost, Serializable group) { | |
38 | 0 | return store(key,val,expiresAt,cost,group,null); |
39 | } | |
40 | ||
41 | /** | |
42 | * Returns <tt>false</tt>. | |
43 | * @return <tt>false</tt>. | |
44 | */ | |
45 | public boolean wantsSerializedForm() { | |
46 | 0 | return false; |
47 | } | |
48 | ||
49 | public abstract int canStore(Serializable key, Serializable val, Long expiresAt, Long cost, Serializable group, byte[] serialized); | |
50 | public abstract boolean store(Serializable key, Serializable val, Long expiresAt, Long cost, Serializable group, byte[] serialized); | |
51 | public abstract Serializable retrieve(Serializable key); | |
52 | public abstract boolean contains(Serializable key); | |
53 | public abstract float capacity(); | |
54 | public abstract void clear(Serializable key); | |
55 | public abstract void setCache(Cache c); | |
56 | public abstract void unsetCache(); | |
57 | ||
58 | } |