1
|
package eu.etaxonomy.cdm.model;
|
2
|
|
3
|
import java.util.UUID;
|
4
|
|
5
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
6
|
|
7
|
/**
|
8
|
* @author cmathew
|
9
|
*
|
10
|
* Cache class for CDM Entities based on Ehcache.
|
11
|
* The class manages a singleton {@link net.sf.ehcache.CacheManager} having a
|
12
|
* {@link net.sf.ehcache.Cache} initialised with a default configuration.
|
13
|
*
|
14
|
* FIXME: This interface should actually be in an external project which also
|
15
|
* includes the implemented cachers.
|
16
|
*
|
17
|
* @param <T>
|
18
|
*/
|
19
|
public interface ICdmCacher<T extends CdmBase> {
|
20
|
|
21
|
/**
|
22
|
* Puts the (Key,Value) pair of ({@link java.util.UUID}, {@link eu.etaxonomy.cdm.model.common.CdmBase}),
|
23
|
* in the cache
|
24
|
*
|
25
|
* @param uuid
|
26
|
* @param cdmEntity
|
27
|
*/
|
28
|
public T put(UUID uuid, T cdmEntity);
|
29
|
|
30
|
/**
|
31
|
* Load a CDM Entity object with given UUID.
|
32
|
* This method checks the (default) cache for the entity,
|
33
|
* else retrieves the entity from the service layer.
|
34
|
*
|
35
|
* NOTE : Currently this method can only be used for CDM Term
|
36
|
* (DefinedTermBase) entities.
|
37
|
*
|
38
|
* @param uuid of CDM Entity to return
|
39
|
* @return
|
40
|
*/
|
41
|
public T load(UUID uuid);
|
42
|
|
43
|
/**
|
44
|
* Get a CDM Entity object with given UUID from the (default) cache.
|
45
|
*
|
46
|
* @param uuid
|
47
|
* @return
|
48
|
*/
|
49
|
public T getFromCache(UUID uuid);
|
50
|
|
51
|
/**
|
52
|
* Check if a CDM Entity with given UUID exists in the cache.
|
53
|
*
|
54
|
* @param uuid of CDM Entity to check
|
55
|
* @return true if CDM Entity with given UUID exists in the cache, o/w false
|
56
|
*/
|
57
|
public boolean exists(UUID uuid);
|
58
|
|
59
|
/**
|
60
|
* Check if a CDM Entity with given UUID exists in the cache
|
61
|
* and that it is not null.
|
62
|
*
|
63
|
* @param uuid of CDM Entity to check
|
64
|
* @return true if CDM Entity with given UUID exists in the cache and that it is not null, o/w false
|
65
|
*/
|
66
|
public boolean existsAndIsNotNull(UUID uuid);
|
67
|
|
68
|
}
|