01: /**
02: * Objective Database Abstraction Layer (ODAL)
03: * Copyright (c) 2004, The ODAL Development Group
04: * All rights reserved.
05: * For definition of the ODAL Development Group please refer to LICENCE.txt file
06: *
07: * Distributable under LGPL license.
08: * See terms of license at gnu.org.
09: */package com.completex.objective.components.ocache;
10:
11: /**
12: * Cache with defined key factory that can produce key from the value
13: *
14: * @author Gennady Krizhevsky
15: */
16: public interface OdalKeyedCache extends OdalCache {
17:
18: public static final NullOdalKeyedCache NULL_ODAL_KEYED_CACHE = new NullOdalKeyedCache(
19: "NULL_ODAL_KEYED_CACHE");
20:
21: /**
22: * Returns OdalKeyFactory for this linked cache
23: *
24: * @return OdalKeyFactory for this linked cache
25: */
26: OdalKeyFactory getKeyFactory();
27:
28: /**
29: * Returns true if the POs in collections have to be marked as "from cache" after the retrieval
30: *
31: * @return true if the POs in collections have to be marked as "from cache" after the retrieval
32: */
33: boolean isMarkCacheCollectionElements();
34:
35: /**
36: * Puts value into cache using getOdalKeyFactory() to extract the key
37: *
38: * @param value value to cache
39: */
40: void put(Object value);
41:
42: /**
43: * Null OdalKeyedCache implementation
44: */
45: public static class NullOdalKeyedCache extends NullOdalCache
46: implements OdalKeyedCache {
47:
48: public NullOdalKeyedCache(String name) {
49: super (name);
50: }
51:
52: public OdalKeyFactory getKeyFactory() {
53: return OdalKeyFactory.NULL_ODAL_KEY_FACTORY;
54: }
55:
56: public boolean isMarkCacheCollectionElements() {
57: return false;
58: }
59:
60: public void put(Object value) {
61: }
62:
63: }
64: }
|