View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.ehcache;
18  
19  /***
20   * Provides pluggable storage and configuration of TTI eviction data.
21   * 
22   * @author Geert Bevin
23   * @version $Id: ElementEvictionData.html 13146 2011-08-01 17:12:39Z oletizi $
24   */
25  public interface ElementEvictionData extends Cloneable {
26  
27      /***
28       * Sets the element creation time. Note that this is optional to implement and might result in a no-op.
29       * 
30       * @param creationTime the new element's creation time
31       */
32      public void setCreationTime(long creationTime);
33      
34      /***
35       * Get the element's creation time.
36       * 
37       * @return the element's creation time in seconds
38       */
39      public long getCreationTime();
40  
41      /***
42       * Gets the last access time.
43       * Access means a get. So a newly created {@link Element} will have a last
44       * access time equal to its create time.
45       * 
46       * @return the element's last access time in seconds
47       */
48      public long getLastAccessTime();
49  
50      /***
51       * Updates the last access time.
52       * 
53       * @param time
54       *            the new last access time
55       * @param element
56       *            the element for which the last access time is set
57       */
58      public void updateLastAccessTime(long time, Element element);
59  
60      /***
61       * Resets the last access time.
62       * 
63       * @param element
64       *            the element for which the last access time is set
65       */
66      public void resetLastAccessTime(Element element);
67  
68      /***
69       * Creates a clone of the eviction data
70       * 
71       * @return a clone of the eviction data
72       * @throws CloneNotSupportedException
73       */
74      public ElementEvictionData clone() throws CloneNotSupportedException;
75  
76      /***
77       * Indicates whether the data of this element eviction instance can
78       * participate in serialization of the element as a whole.
79       * 
80       * @return {@code true} when the data can participate in serialization; or
81       *         {@code false} otherwise
82       */
83      public boolean canParticipateInSerialization();
84  }