// Path: src/main/java/io/s4/util/clock/Clock.java
// public interface Clock {
// 
//     public long waitForTime(long targetTime);
// 
//     public long getCurrentTime();
// 
// }


import io.s4.util.clock.Clock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
/*
 * Copyright (c) 2010 Yahoo! Inc. All rights reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 	        http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the
 * License. See accompanying LICENSE file. 
 */
package io.s4.persist;




public class HashMapPersister implements Persister {
    private volatile int persistCount = 0;
    private boolean selfClean = false;
    private int cleanWaitTime = 40; // 40 seconds by default
    private String loggerName = "s4";
    Map<String, CacheEntry> cache;
    Clock s4Clock;

    private int startCapacity = 5000;

    public void setStartCapacity(int startCapacity) {
        this.startCapacity = startCapacity;
    }

    public int getStartCapacity() {
        return startCapacity;
    }

    public void setSelfClean(boolean selfClean) {
        this.selfClean = selfClean;
    }

    public void setCleanWaitTime(int cleanWaitTime) {
        this.cleanWaitTime = cleanWaitTime;
    }

    public void setLoggerName(String loggerName) {
        this.loggerName = loggerName;
    }

    public HashMapPersister(Clock s4Clock) {
        this.s4Clock = s4Clock;
    }
    
// Path: src/main/java/io/s4/util/clock/Clock.java
// public interface Clock {
// 
//     public long waitForTime(long targetTime);
// 
//     public long getCurrentTime();
// 
// }


// Path: src/main/java/io/s4/persist/HashMapPersister.java
import io.s4.util.clock.Clock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;

/*
 * Copyright (c) 2010 Yahoo! Inc. All rights reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 	        http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the
 * License. See accompanying LICENSE file. 
 */
package io.s4.persist;




public class HashMapPersister implements Persister {
    private volatile int persistCount = 0;
    private boolean selfClean = false;
    private int cleanWaitTime = 40; // 40 seconds by default
    private String loggerName = "s4";
    Map<String, CacheEntry> cache;
    Clock s4Clock;

    private int startCapacity = 5000;

    public void setStartCapacity(int startCapacity) {
        this.startCapacity = startCapacity;
    }

    public int getStartCapacity() {
        return startCapacity;
    }

    public void setSelfClean(boolean selfClean) {
        this.selfClean = selfClean;
    }

    public void setCleanWaitTime(int cleanWaitTime) {
        this.cleanWaitTime = cleanWaitTime;
    }

    public void setLoggerName(String loggerName) {
        this.loggerName = loggerName;
    }

    public HashMapPersister(Clock s4Clock) {
        this.s4Clock = s4Clock;
    }
    
    public void setS4Clock(Clock s4Clock) {