%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jcs.auxiliary.disk.LRUMapJCS |
|
|
1 | package org.apache.jcs.auxiliary.disk; |
|
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.logging.Log; |
|
23 | import org.apache.commons.logging.LogFactory; |
|
24 | import org.apache.jcs.utils.struct.LRUMap; |
|
25 | ||
26 | /** |
|
27 | * Extension of LRUMap for logging of removals. Can switch this back to a HashMap easily. This |
|
28 | * provides some abstraction. It also makes it easy to log overflow. |
|
29 | */ |
|
30 | public class LRUMapJCS |
|
31 | extends LRUMap |
|
32 | { |
|
33 | /** Don't change */ |
|
34 | private static final long serialVersionUID = 776964015449842672L; |
|
35 | ||
36 | /** The logger */ |
|
37 | 264 | private static final Log log = LogFactory.getLog( LRUMapJCS.class ); |
38 | ||
39 | /** |
|
40 | * This creates an unbounded version. |
|
41 | */ |
|
42 | public LRUMapJCS() |
|
43 | { |
|
44 | 0 | super(); |
45 | 0 | } |
46 | ||
47 | /** |
|
48 | * This creates a list bounded by the max key size argument. The Boundary is enforces by an LRU |
|
49 | * eviction policy. |
|
50 | * <p> |
|
51 | * This is used in the Disk cache to store keys and purgatory elements if a boundary is |
|
52 | * requested. |
|
53 | * <p> |
|
54 | * The LRU memory cache uses its own LRU implementation. |
|
55 | * <p> |
|
56 | * @param maxKeySize |
|
57 | */ |
|
58 | public LRUMapJCS( int maxKeySize ) |
|
59 | { |
|
60 | 1203 | super( maxKeySize ); |
61 | 1203 | } |
62 | ||
63 | /** |
|
64 | * This is called when an item is removed from the LRU. We just log some information. |
|
65 | * <p> |
|
66 | * @param key |
|
67 | * @param value |
|
68 | */ |
|
69 | protected void processRemovedLRU( Object key, Object value ) |
|
70 | { |
|
71 | 6564 | if ( log.isDebugEnabled() ) |
72 | { |
|
73 | 0 | log.debug( "Removing key [" + key + "] from key store, value [" + value + "]" ); |
74 | 0 | log.debug( "Key store size [" + this.size() + "]" ); |
75 | } |
|
76 | 6564 | } |
77 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |