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 java.util.Set;
20
21 import net.sf.ehcache.Element;
22
23 /***
24 * Use for internal purpose only. Teaser: Stores of Terracotta clustered caches implements this interface.
25 *
26 * @author Abhishek Sanoujam
27 *
28 */
29 public interface TerracottaStore extends Store {
30
31 /***
32 * Returns the local value associated with the key. Local value means that the object mapped to the key is present in the VM locally. In
33 * case its not, will return null. Note that even when returning null, the value may be present in the Terracotta server array.
34 * <p/>
35 * This operation does not acquire any locks when doing the operation and may return stale values.
36 *
37 * @param key
38 * the key
39 * @return the element associated with key or null
40 */
41 public Element unsafeGet(Object key);
42
43 /***
44 * Same as {@link #unsafeGet(Object)} but does not update last usage statistics
45 *
46 * @param key
47 * the key
48 * @return the element associated with key or null
49 */
50 public Element unsafeGetQuiet(Object key);
51
52 /***
53 * Gets the value associated with the key without acquiring any locks. This may return stale values as locks are not acquired.
54 *
55 * @param key
56 * @return the element associated with the key or null
57 */
58 public Element unlockedGet(Object key);
59
60 /***
61 * Same as {@link #unlockedGet(Object)} but does not update statistics
62 *
63 * @param key
64 * @return the element associated with the key or null
65 */
66 public Element unlockedGetQuiet(Object key);
67
68
69 /***
70 * Returns set of keys from the cache which are present in the node locally.
71 * @return set of keys present locally in the node
72 */
73 public Set getLocalKeys();
74
75 }