View Javadoc

1   /*
2    * Copyright (c) 2004-2005, University Health Network.  All rights reserved. Distributed under the BSD 
3    * license (see http://opensource.org/licenses/bsd-license.php).
4    *  
5    * Created on 30-Dec-2004
6    */
7   package ca.uhn.cache.internal;
8   
9   
10  /***
11   * Temporary interface to cache store for purging data.  After 1st release these methods will be 
12   * moved to IChunkStore and IQueryResultStore.   
13   * 
14   * Note: minimum stored data includes: query, expiry time, vogueness modifier, and 
15   * vogueness.  
16   * 
17   * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
18   * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:53:27 $ by $Author: bryan_tripp $
19   */
20  public interface IChunkPurger {
21  
22      /***
23       * Returns chunks that have not been accessed recently.  Specifically, those for which 
24       * vogueness < theVoguenessThreshold.
25       * 
26       * Recall from IUnusedChunkRule that vogueness = last access time + modifier.  
27       * 
28       * Implementation hint: to avoid doing a calculation during the query, store the 
29       * modified version of last access time, and implement this method as 
30       * "select chunks where mod_last_access earlier than theMaxAccessTime". 
31       *   
32       * @param theVoguenessThreshold chunks that have not been accessed since this time
33       *      (accounting for modifier) are to be returned
34       * @return chunks for which the modified access time is earlier than theMaxAccessTime
35       */
36      public IChunkIterator getUnusedChunks(long theVoguenessThreshold);
37          
38      /***
39       * Implementation hint: to avoid doing a calculation during the query, store 
40       * chunk with its expiry time, not its max age, and implement this method as 
41       * "select chunks where expiry time earlier than now".  
42       * 
43       * @return chunks that have been in the cache longer than their maximum ages.  
44       */
45      public IChunkIterator getStaleChunks();
46      
47      /***
48       * @return lowest vogueness of all chunks (based on the time at which the least recently 
49       *      used chunk was accessed; see IUnusedChunkRule) 
50       */
51      public long getLowestVogueness();
52      
53      /***
54       * @return the number of records currently stored by the cache 
55       */
56      public int getNumCachedItems();
57      
58  }