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.pool;
18  
19  import net.sf.ehcache.store.Store;
20  
21  /***
22   * A poolable store reports its resource usage to a {@link Pool}.
23   *
24   * @author Ludovic Orban
25   */
26  public interface PoolableStore extends Store {
27  
28      /***
29       * Perform eviction to release on-heap resources
30       *
31       * @param count the number of elements to evict
32       * @param size the size in bytes to free (hint)
33       * @return true if the requested number of elements could be evicted
34       */
35      boolean evictFromOnHeap(int count, long size);
36  
37      /***
38       * Perform eviction to release on-disk resources
39       *
40       * @param count the number of elements to evict
41       * @param size the size in bytes to free (hint)
42       * @return true if the requested number of elements could be evicted
43       */
44      boolean evictFromOnDisk(int count, long size);
45  
46      /***
47       * Return the approximate disk hit rate
48       *
49       * @return the approximate disk hit rate
50       */
51      float getApproximateDiskHitRate();
52  
53      /***
54       * Return the approximate disk miss rate
55       *
56       * @return the approximate disk miss rate
57       */
58      float getApproximateDiskMissRate();
59  
60      /***
61       * Return the approximate disk size
62       *
63       * @return the approximate disk size
64       */
65      long getApproximateDiskCountSize();
66      
67      /***
68       * Return the approximate disk size in bytes
69       *
70       * @return the approximate disk size in bytes
71       */
72      long getApproximateDiskByteSize();
73      
74      /***
75       * Return the approximate heap hit rate
76       *
77       * @return the approximate heap hit rate
78       */
79      float getApproximateHeapHitRate();
80  
81      /***
82       * Return the approximate heap miss rate
83       *
84       * @return the approximate heap miss rate
85       */
86      float getApproximateHeapMissRate();
87  
88      /***
89       * Return the approximate heap size
90       *
91       * @return the approximate heap size
92       */
93      long getApproximateHeapCountSize();
94  
95      /***
96       * Return the approximate heap size in bytes
97       *
98       * @return the approximate heap size in bytes
99       */
100     long getApproximateHeapByteSize();
101 }