| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| org.apache.jcs.auxiliary.disk.block.BlockDiskCacheAttributes |
|
|
| 1 | package org.apache.jcs.auxiliary.disk.block; |
|
| 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.jcs.auxiliary.disk.AbstractDiskCacheAttributes; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * This holds attributes for Block Disk Cache configuration. |
|
| 26 | * <p> |
|
| 27 | * @author Aaron Smuts |
|
| 28 | */ |
|
| 29 | 40 | public class BlockDiskCacheAttributes |
| 30 | extends AbstractDiskCacheAttributes |
|
| 31 | { |
|
| 32 | /** Don't change */ |
|
| 33 | private static final long serialVersionUID = 6568840097657265989L; |
|
| 34 | ||
| 35 | /** The size per block in bytes. */ |
|
| 36 | private int blockSizeBytes; |
|
| 37 | ||
| 38 | /** Maximum number of keys to be kept in memory */ |
|
| 39 | private static final int DEFAULT_MAX_KEY_SIZE = 5000; |
|
| 40 | ||
| 41 | /** -1 means no limit. */ |
|
| 42 | 40 | private int maxKeySize = DEFAULT_MAX_KEY_SIZE; |
| 43 | ||
| 44 | /** How often should we persist the keys. */ |
|
| 45 | private static final long DEFAULT_KEY_PERSISTENCE_INTERVAL_SECONDS = 5 * 60; |
|
| 46 | ||
| 47 | /** The keys will be persisted at this interval. -1 mean never. */ |
|
| 48 | 40 | private long keyPersistenceIntervalSeconds = DEFAULT_KEY_PERSISTENCE_INTERVAL_SECONDS; |
| 49 | ||
| 50 | /** |
|
| 51 | * The size of the blocks. All blocks are the same size. |
|
| 52 | * <p> |
|
| 53 | * @param blockSizeBytes The blockSizeBytes to set. |
|
| 54 | */ |
|
| 55 | public void setBlockSizeBytes( int blockSizeBytes ) |
|
| 56 | { |
|
| 57 | 16 | this.blockSizeBytes = blockSizeBytes; |
| 58 | 16 | } |
| 59 | ||
| 60 | /** |
|
| 61 | * @return Returns the blockSizeBytes. |
|
| 62 | */ |
|
| 63 | public int getBlockSizeBytes() |
|
| 64 | { |
|
| 65 | 415 | return blockSizeBytes; |
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * @param maxKeySize The maxKeySize to set. |
|
| 70 | */ |
|
| 71 | public void setMaxKeySize( int maxKeySize ) |
|
| 72 | { |
|
| 73 | 48 | this.maxKeySize = maxKeySize; |
| 74 | 48 | } |
| 75 | ||
| 76 | /** |
|
| 77 | * @return Returns the maxKeySize. |
|
| 78 | */ |
|
| 79 | public int getMaxKeySize() |
|
| 80 | { |
|
| 81 | 240 | return maxKeySize; |
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * @param keyPersistenceIntervalSeconds The keyPersistenceIntervalSeconds to set. |
|
| 86 | */ |
|
| 87 | public void setKeyPersistenceIntervalSeconds( long keyPersistenceIntervalSeconds ) |
|
| 88 | { |
|
| 89 | 0 | this.keyPersistenceIntervalSeconds = keyPersistenceIntervalSeconds; |
| 90 | 0 | } |
| 91 | ||
| 92 | /** |
|
| 93 | * @return Returns the keyPersistenceIntervalSeconds. |
|
| 94 | */ |
|
| 95 | public long getKeyPersistenceIntervalSeconds() |
|
| 96 | { |
|
| 97 | 368 | return keyPersistenceIntervalSeconds; |
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Write out the values for debugging purposes. |
|
| 102 | * <p> |
|
| 103 | * @return String |
|
| 104 | */ |
|
| 105 | public String toString() |
|
| 106 | { |
|
| 107 | 112 | StringBuffer str = new StringBuffer(); |
| 108 | 112 | str.append( "\nBlockDiskAttributes " ); |
| 109 | 112 | str.append( "\n DiskPath [" + this.getDiskPath() + "]" ); |
| 110 | 112 | str.append( "\n MaxKeySize [" + this.getMaxKeySize() + "]" ); |
| 111 | 112 | str.append( "\n MaxPurgatorySize [" + this.getMaxPurgatorySize() + "]" ); |
| 112 | 112 | str.append( "\n BlockSizeBytes [" + this.getBlockSizeBytes() + "]" ); |
| 113 | 112 | str.append( "\n KeyPersistenceIntervalSeconds [" + this.getKeyPersistenceIntervalSeconds() + "]" ); |
| 114 | 112 | return str.toString(); |
| 115 | } |
|
| 116 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |