001package org.apache.commons.jcs3.auxiliary.disk.behavior; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.io.File; 023 024import org.apache.commons.jcs3.auxiliary.AuxiliaryCacheAttributes; 025 026/** 027 * Common disk cache attributes. 028 */ 029public interface IDiskCacheAttributes 030 extends AuxiliaryCacheAttributes 031{ 032 enum DiskLimitType { 033 /** limit elements by count (default) */ 034 COUNT, 035 /** limit elements by their size */ 036 SIZE 037 } 038 /** 039 * This is the default purgatory size limit. Purgatory is the area where 040 * items to be spooled are temporarily stored. It basically provides access 041 * to items on the to-be-spooled queue. 042 */ 043 int MAX_PURGATORY_SIZE_DEFAULT = 5000; 044 045 /** 046 * Sets the diskPath attribute of the IJISPCacheAttributes object 047 * <p> 048 * @param path 049 * The new diskPath value 050 */ 051 void setDiskPath( String path ); 052 053 /** 054 * Gets the diskPath attribute of the attributes object 055 * <p> 056 * @return The diskPath value 057 */ 058 File getDiskPath(); 059 060 /** 061 * Gets the maxKeySize attribute of the DiskCacheAttributes object 062 * <p> 063 * @return The maxPurgatorySize value 064 */ 065 int getMaxPurgatorySize(); 066 067 /** 068 * Sets the maxPurgatorySize attribute of the DiskCacheAttributes object 069 * <p> 070 * @param maxPurgatorySize 071 * The new maxPurgatorySize value 072 */ 073 void setMaxPurgatorySize( int maxPurgatorySize ); 074 075 /** 076 * Get the amount of time in seconds we will wait for elements to move to 077 * disk during shutdown for a particular region. 078 * <p> 079 * @return the time in seconds. 080 */ 081 int getShutdownSpoolTimeLimit(); 082 083 /** 084 * Sets the amount of time in seconds we will wait for elements to move to 085 * disk during shutdown for a particular region. 086 * <p> 087 * This is how long we give the event queue to empty. 088 * <p> 089 * The default is 60 seconds. 090 * <p> 091 * @param shutdownSpoolTimeLimit 092 * the time in seconds 093 */ 094 void setShutdownSpoolTimeLimit( int shutdownSpoolTimeLimit ); 095 096 /** 097 * If this is true then remove all is not prohibited. 098 * <p> 099 * @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}