/*
 * JBoss, Home of Professional Open Source
 * Copyright 2005, JBoss Inc., and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.cache;

import org.jboss.system.Service;

/**
 * Interface to be implemented by cache eviction policy handlers. Implementation
 * may register as {@link CacheListener}s, and handle cache eviction (if
 * necessary) when an entry is added, or they may choose to run in a background
 * thread and periodically check cache size against specified max cache size.
 * <br/>
 * An eviction policy has a reference to the cache for which it performs
 * eviction. It can therefore read the properties of the cache and access the
 * cache's methods.
 * <br/> Since this class extends from {@link Service}, its
 * methods {@link org.jboss.system.Service#create()}, {@link org.jboss.system.Service#start()},
 * {@link org.jboss.system.Service#stop()} and
 * {@link org.jboss.system.Service#destroy()} will be called for lifecycle management.
 * @author Bela Ban
 * @version $Revision: 1.1.2.1 $
 */
public interface EvictionPolicy extends Service {

    /** The cache for which we do eviction. This is called before all other lifecycle callbacks */
    void setCache(CacheImpl c);
}
