01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.object.cache;
06:
07: import com.tc.properties.TCProperties;
08: import com.tc.util.Assert;
09:
10: public class LFUConfigImpl implements LFUConfig {
11:
12: private final float agingFactor;
13: private final int ignorePercentage;
14: private final boolean debug;
15:
16: public LFUConfigImpl(TCProperties lfuProperties) {
17: agingFactor = lfuProperties.getFloat("agingFactor");
18: Assert.assertTrue("Invalid agingFactor in properties file",
19: agingFactor >= 0.0 && agingFactor <= 1.0);
20: ignorePercentage = lfuProperties
21: .getInt("recentlyAccessedIgnorePercentage");
22: Assert
23: .assertTrue(
24: "Invalid recentlyAccessedIgnorePercentage in properties file",
25: ignorePercentage >= 0
26: && ignorePercentage <= 100);
27: debug = lfuProperties.getBoolean("debug.enabled");
28: }
29:
30: public float getAgingFactor() {
31: return agingFactor;
32: }
33:
34: public int getRecentlyAccessedIgnorePercentage() {
35: return ignorePercentage;
36: }
37:
38: public boolean isDebugEnabled() {
39: return debug;
40: }
41:
42: }
|