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.cache;
10:
11: import java.sql.SQLException;
12:
13: /**
14: * Two-level cache interface. 1st level is cache of contexts.
15: * 2nd is cache of resources within given context. It is convenient
16: * for implementation of PreparedStatement cache, for example, where
17: * statements are cached withing given Connection.
18: *
19: * @author Andrew Suprun
20: */
21: public interface Cache {
22:
23: /**
24: * Acquire cached resource
25: *
26: * @param context
27: * @param key
28: * @return cached resource
29: * @throws SQLException
30: */
31: Object acquire(Object context, Object key) throws SQLException;
32:
33: /**
34: * Release cached resource
35: *
36: * @param context
37: * @param res - cached resource
38: * @throws SQLException
39: */
40: void release(Object context, Object res) throws SQLException;
41: }
|