001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.openjpa.persistence;
020:
021: import java.util.Collection;
022:
023: import org.apache.openjpa.datacache.DataCache;
024:
025: /**
026: * Represents the L2 cache over the data store.
027: *
028: * @author Abe White
029: * @since 0.4.1
030: * @published
031: */
032: public interface StoreCache {
033:
034: public static final String NAME_DEFAULT = DataCache.NAME_DEFAULT;
035:
036: /**
037: * Whether the cache contains data for the given oid.
038: */
039: public boolean contains(Class cls, Object oid);
040:
041: /**
042: * Whether the cache contains data for the given oids.
043: */
044: public boolean containsAll(Class cls, Object... oids);
045:
046: /**
047: * Whether the cache contains data for the given oids.
048: */
049: public boolean containsAll(Class cls, Collection oids);
050:
051: /**
052: * Pin the data for the given oid to the cache.
053: */
054: public void pin(Class cls, Object oid);
055:
056: /**
057: * Pin the data for the given oids to the cache.
058: */
059: public void pinAll(Class cls, Object... oids);
060:
061: /**
062: * Pin the data for the given oids to the cache.
063: */
064: public void pinAll(Class cls, Collection oids);
065:
066: /**
067: * Unpin the data for the given oid from the cache.
068: */
069: public void unpin(Class cls, Object oid);
070:
071: /**
072: * Unpin the data for the given oids from the cache.
073: */
074: public void unpinAll(Class cls, Object... oids);
075:
076: /**
077: * Unpin the data for the given oids from the cache.
078: */
079: public void unpinAll(Class cls, Collection oids);
080:
081: /**
082: * Remove data for the given oid from the cache.
083: */
084: public void evict(Class cls, Object oid);
085:
086: /**
087: * Remove data for the given oids from the cache.
088: */
089: public void evictAll(Class cls, Object... oids);
090:
091: /**
092: * Remove data for the given oids from the cache.
093: */
094: public void evictAll(Class cls, Collection oids);
095:
096: /**
097: * Clear the cache.
098: */
099: public void evictAll();
100:
101: /**
102: * @deprecated cast to {@link StoreCacheImpl} instead. This
103: * method pierces the published-API boundary, as does the SPI cast.
104: */
105: public DataCache getDelegate();
106: }
|