1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package javax.jdo.datastore;
23
24 import java.util.Collection;
25
26
27 /***
28 * Many JDO implementations allow instances to be cached in a
29 * second-level cache, and allow direct management of the cache by
30 * knowledgeable applications. This interface standardizes this
31 * behavior.
32 * @since 2.0
33 * @version 2.0
34 */
35 public interface DataStoreCache {
36
37 /*** Evict the parameter instance from the second-level cache.
38 * @param oid the object id of the instance to evict.
39 * @since 2.0
40 */
41 void evict (Object oid);
42
43 /*** Evict the parameter instances from the second-level cache.
44 * All instances in the PersistenceManager's cache are evicted
45 * from the second-level cache.
46 * @since 2.0
47 */
48 void evictAll ();
49
50 /*** Evict the parameter instances from the second-level cache.
51 * @param oids the object ids of the instance to evict.
52 * @since 2.0
53 */
54 void evictAll (Object[] oids);
55
56 /*** Evict the parameter instances from the second-level cache.
57 * @param oids the object ids of the instance to evict.
58 * @since 2.0
59 */
60 void evictAll (Collection oids);
61
62 /*** Evict the parameter instances from the second-level cache.
63 * @param pcClass the class of instances to evict
64 * @param subclasses if true, evict instances of subclasses also
65 * @since 2.0
66 */
67 void evictAll (Class pcClass, boolean subclasses);
68
69 /*** Pin the parameter instance in the second-level cache.
70 * @param oid the object id of the instance to pin.
71 * @since 2.0
72 */
73 void pin (Object oid);
74
75 /*** Pin the parameter instances in the second-level cache.
76 * @param oids the object ids of the instances to pin.
77 * @since 2.0
78 */
79 void pinAll (Collection oids);
80
81 /*** Pin the parameter instances in the second-level cache.
82 * @param oids the object ids of the instances to pin.
83 * @since 2.0
84 */
85 void pinAll (Object[] oids);
86
87 /*** Pin instances in the second-level cache.
88 * @param pcClass the class of instances to pin
89 * @param subclasses if true, pin instances of subclasses also
90 * @since 2.0
91 */
92 void pinAll (Class pcClass, boolean subclasses);
93
94 /*** Unpin the parameter instance from the second-level cache.
95 * @param oid the object id of the instance to unpin.
96 * @since 2.0
97 */
98 void unpin(Object oid);
99
100 /*** Unpin the parameter instances from the second-level cache.
101 * @param oids the object ids of the instance to evict.
102 * @since 2.0
103 */
104 void unpinAll(Collection oids);
105
106 /*** Unpin the parameter instance from the second-level cache.
107 * @param oids the object id of the instance to evict.
108 * @since 2.0
109 */
110 void unpinAll(Object[] oids);
111
112 /*** Unpin instances from the second-level cache.
113 * @param pcClass the class of instances to unpin
114 * @param subclasses if true, unpin instances of subclasses also
115 * @since 2.0
116 */
117 void unpinAll(Class pcClass, boolean subclasses);
118
119 /***
120 * This class is an empty implementation of the DataStoreCache
121 * interface. It can be used by an implementation that does not
122 * support a second-level cache.
123 * @since 2.0
124 */
125 public class EmptyDataStoreCache implements DataStoreCache {
126
127 public EmptyDataStoreCache() {
128 }
129
130 public void evict(Object oid) {
131 }
132
133 public void evictAll() {
134 }
135
136 public void evictAll(Object[] oids) {
137 }
138
139 public void evictAll(Collection oids) {
140 }
141
142 public void evictAll(Class pcClass, boolean subclasses) {
143 }
144
145 public void pin(Object oid) {
146 }
147
148 public void pinAll(Object[] oids) {
149 }
150
151 public void pinAll(Collection oids) {
152 }
153
154 public void pinAll(Class pcClass, boolean subclasses) {
155 }
156
157 public void unpin(Object oid) {
158 }
159
160 public void unpinAll(Object[] oids) {
161 }
162
163 public void unpinAll(Collection oids) {
164 }
165
166 public void unpinAll(Class pcClass, boolean subclasses) {
167 }
168 }
169 }