01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.persistence;
20:
21: import javax.persistence.Query;
22:
23: import org.apache.openjpa.datacache.QueryCache;
24:
25: /**
26: * Query result cache.
27: *
28: * @author Abe White
29: * @since 0.4.1
30: * @published
31: */
32: public interface QueryResultCache {
33:
34: /**
35: * Pin the given query's result to the cache.
36: */
37: public void pin(Query q);
38:
39: /**
40: * Unpin a previously-pinned query result.
41: */
42: public void unpin(Query q);
43:
44: /**
45: * Evict a query result from the cache.
46: */
47: public void evict(Query q);
48:
49: /**
50: * Clear the cache.
51: */
52: public void evictAll();
53:
54: /**
55: * Evict all result for queries involving the given class.
56: */
57: public void evictAll(Class cls);
58:
59: /**
60: * @deprecated cast to {@link QueryResultCacheImpl} instead. This
61: * method pierces the published-API boundary, as does the SPI cast.
62: */
63: public QueryCache getDelegate();
64: }
|