View Javadoc
1   package org.apache.commons.jcs.auxiliary.disk.behavior;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
23  
24  import java.io.File;
25  
26  /**
27   * Common disk cache attributes.
28   */
29  public interface IDiskCacheAttributes
30      extends AuxiliaryCacheAttributes
31  {
32      enum DiskLimitType {
33          /** limit elements by count (default) */
34          COUNT,
35          /** limit elements by their size */
36          SIZE
37      }
38      /**
39       * This is the default purgatory size limit. Purgatory is the area where
40       * items to be spooled are temporarily stored. It basically provides access
41       * to items on the to-be-spooled queue.
42       */
43      int MAX_PURGATORY_SIZE_DEFAULT = 5000;
44  
45      /**
46       * Sets the diskPath attribute of the IJISPCacheAttributes object
47       * <p>
48       * @param path
49       *            The new diskPath value
50       */
51      void setDiskPath( String path );
52  
53      /**
54       * Gets the diskPath attribute of the attributes object
55       * <p>
56       * @return The diskPath value
57       */
58      File getDiskPath();
59  
60      /**
61       * Gets the maxKeySize attribute of the DiskCacheAttributes object
62       * <p>
63       * @return The maxPurgatorySize value
64       */
65      int getMaxPurgatorySize();
66  
67      /**
68       * Sets the maxPurgatorySize attribute of the DiskCacheAttributes object
69       * <p>
70       * @param maxPurgatorySize
71       *            The new maxPurgatorySize value
72       */
73      void setMaxPurgatorySize( int maxPurgatorySize );
74  
75      /**
76       * Get the amount of time in seconds we will wait for elements to move to
77       * disk during shutdown for a particular region.
78       * <p>
79       * @return the time in seconds.
80       */
81      int getShutdownSpoolTimeLimit();
82  
83      /**
84       * Sets the amount of time in seconds we will wait for elements to move to
85       * disk during shutdown for a particular region.
86       * <p>
87       * This is how long we give the event queue to empty.
88       * <p>
89       * The default is 60 seconds.
90       * <p>
91       * @param shutdownSpoolTimeLimit
92       *            the time in seconds
93       */
94      void setShutdownSpoolTimeLimit( int shutdownSpoolTimeLimit );
95  
96      /**
97       * If this is true then remove all is not prohibited.
98       * <p>
99       * @return boolean
100      */
101     boolean isAllowRemoveAll();
102 
103     /**
104      * If this is false, then remove all requests will not be honored.
105      * <p>
106      * This provides a safety mechanism for the persistent store.
107      * <p>
108      * @param allowRemoveAll
109      */
110     void setAllowRemoveAll( boolean allowRemoveAll );
111 
112     /**
113      * set the type of the limit of the cache size
114      * @param diskLimitType COUNT - limit by count of the elements, SIZE, limit by sum of element's size
115      */
116     void setDiskLimitType(DiskLimitType diskLimitType);
117 
118     /**
119      * Translates and stores String values  of DiskLimitType
120      *
121      * Allowed values: "COUNT" and "SIZE"
122      * @param diskLimitTypeName
123      */
124     void setDiskLimitTypeName(String diskLimitTypeName);
125 
126     /**
127      *
128      * @return active DiskLimitType
129      */
130     DiskLimitType getDiskLimitType();
131 }