Project

General

Profile

Download (1.72 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
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
package eu.etaxonomy.cdm.model;
10

    
11
import eu.etaxonomy.cdm.model.common.CdmBase;
12

    
13
/**
14
 * @author cmathew
15
 * @since 19 Feb 2015
16
 *
17
 */
18
public interface ICdmCacher {
19

    
20
    /**
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
    public <T extends CdmBase> T getFromCache(T cdmBase);
30

    
31
    /**
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
    public void put(CdmBase cdmEntity);
38

    
39
    /**
40
     * load into the cache and return the entity from the cache. The the entity
41
     * might already exist in the cache. In case the entity in the cache might
42
     * get updated whereas the returned entity represents is the entity from the
43
     * cache not the <code>cdmEntity</code> passed to this method.
44
     *
45
     * @param cdmEntity
46
     * @return
47
     */
48
    public <T extends CdmBase> T load(T cdmEntity);
49

    
50
    /**
51
     *
52
     * @param cdmEntity
53
     * @return returns true if the <code>cdmEntity</code> is cacheable by the
54
     *         implementation
55
     */
56
    public boolean isCachable(CdmBase cdmEntity);
57

    
58
    /**
59
     * @param cdmBase
60
     * @return returns true if the <code>cdmEntity</code> is found in the cache
61
     */
62
    public boolean exists(CdmBase cdmBase);
63

    
64
}
(5-5/8)