1 |
933e5ac3
|
Cherian Mathew
|
/**
|
2 |
|
|
* Copyright (C) 2015 EDIT
|
3 |
|
|
* European Distributed Institute of Taxonomy
|
4 |
|
|
* http://www.e-taxonomy.eu
|
5 |
|
|
*
|
6 |
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7 |
|
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8 |
|
|
*/
|
9 |
93f50b5e
|
Cherian Mathew
|
package eu.etaxonomy.cdm.model;
|
10 |
|
|
|
11 |
|
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
12 |
|
|
|
13 |
|
|
/**
|
14 |
|
|
* @author cmathew
|
15 |
53db84af
|
Andreas Müller
|
* @since 19 Feb 2015
|
16 |
93f50b5e
|
Cherian Mathew
|
*
|
17 |
|
|
*/
|
18 |
933e5ac3
|
Cherian Mathew
|
public interface ICdmCacher {
|
19 |
03aae089
|
Cherian Mathew
|
|
20 |
f1d2990c
|
Andreas Kohlbecker
|
/**
|
21 |
|
|
* Retrieves the cached version of the passed entity from the cache if it
|
22 |
|
|
* exists in there.
|
23 |
|
|
*
|
24 |
|
|
* @param cdmBase
|
25 |
|
|
* the cdm entity to find in the cache
|
26 |
|
|
*
|
27 |
|
|
* @return the cached version of the passed entity or <code>null</code>
|
28 |
|
|
*/
|
29 |
2e6db6fc
|
Andreas Kohlbecker
|
public <T extends CdmBase> T getFromCache(T cdmBase);
|
30 |
03aae089
|
Cherian Mathew
|
|
31 |
f1d2990c
|
Andreas Kohlbecker
|
/**
|
32 |
|
|
* Puts the passed <code>cdmEntity</code> into the cache as long it does not
|
33 |
|
|
* yet exist in the cache.
|
34 |
|
|
*
|
35 |
|
|
* @param cdmEntity
|
36 |
|
|
*/
|
37 |
933e5ac3
|
Cherian Mathew
|
public void put(CdmBase cdmEntity);
|
38 |
03aae089
|
Cherian Mathew
|
|
39 |
f1d2990c
|
Andreas Kohlbecker
|
/**
|
40 |
b1b42293
|
Andreas Müller
|
* Load into the cache and return the entity from the cache. The entity
|
41 |
|
|
* might already exist in the cache. In this case the entity in the cache might
|
42 |
|
|
* get updated whereas the returned entity represents the entity from the
|
43 |
f1d2990c
|
Andreas Kohlbecker
|
* cache not the <code>cdmEntity</code> passed to this method.
|
44 |
|
|
*
|
45 |
|
|
* @param cdmEntity
|
46 |
|
|
* @return
|
47 |
|
|
*/
|
48 |
2e6db6fc
|
Andreas Kohlbecker
|
public <T extends CdmBase> T load(T cdmEntity);
|
49 |
03aae089
|
Cherian Mathew
|
|
50 |
f1d2990c
|
Andreas Kohlbecker
|
/**
|
51 |
|
|
*
|
52 |
|
|
* @param cdmEntity
|
53 |
|
|
* @return returns true if the <code>cdmEntity</code> is cacheable by the
|
54 |
|
|
* implementation
|
55 |
|
|
*/
|
56 |
933e5ac3
|
Cherian Mathew
|
public boolean isCachable(CdmBase cdmEntity);
|
57 |
93f50b5e
|
Cherian Mathew
|
|
58 |
f1d2990c
|
Andreas Kohlbecker
|
/**
|
59 |
|
|
* @param cdmBase
|
60 |
|
|
* @return returns true if the <code>cdmEntity</code> is found in the cache
|
61 |
|
|
*/
|
62 |
2c8c883f
|
Cherian Mathew
|
public boolean exists(CdmBase cdmBase);
|
63 |
|
|
|
64 |
cbfdc57b
|
Andreas Kohlbecker
|
public void dispose();
|
65 |
|
|
|
66 |
933e5ac3
|
Cherian Mathew
|
}
|