1/*2 * Copyright 2000-2001,2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.services.portletcache;
1819import org.apache.jetspeed.portal.expire.Expire;
20import org.apache.turbine.services.cache.CachedObject;
2122/***23 * <p>This is an interface for defining Jetspeed objects that may be 24 * cached in the object cache.</p>25 * <p>Each such object must be able to prodive a caching handle26 * that will uniquely identify it within the cache system</p>27 *28 * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>29 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>30 * @version $Id: Cacheable.java,v 1.7 2004/02/23 03:34:54 jford Exp $31 */32publicinterfaceCacheable33 {
34/***35 * Return true if this Cacheable is allowed to be cached.36 *37 * @return <CODE>TRUE</CODE> if object is cachable<br>38 * <CODE>FALSE</CODE> if object is not cacheable39 */40publicboolean isCacheable();
4142/***43 * Set this cacheable status.44 *45 * @param cacheable Set the cacheability of the object46 */47publicvoid setCacheable(boolean cacheable);
4849/***50 * Used by a Cacheable object to determine when it should expire itself from51 * the cache.52 *53 * @return Expire handle54 */55publicExpire getExpire();
5657/***58 * <p>Used by the cache to get a unique reference on what you want to add59 * and then retrieve in the future from the cache</p>60 *61 * <p>Most implementations should just call the CacheHandleManager with62 * the given params within the implementation and just return this.</p>63 *64 * @deprecated cacheable classes should now implement a static getHandle(config) method65 */66public String getHandle();
6768/****69 * <p>Set the handle for this Cacheable.</p>70 *71 * <p>Note that factories should call setHandle() so that getHandle() always72 * returns a value correctly.</p>73 *74 * @deprecated cacheable classes should now implement a static getHandle(config) method75 */76publicvoid setHandle( String handle );
7778/***79 * Return the expiration time in milliseconds.80 *81 * @return Expiration time in milliseconds since epoch, or null if the 82 * expiration was not set83 */84public Long getExpirationMillis();
8586/***87 * Set the expiration time in milliseconds.88 *89 * @param expirationMillis Set expiration in millis90 */91publicvoid setExpirationMillis( long expirationMillis);
9293/***94 * This allows the associated CachedObject to be95 * known. One use of the <code>co</code> is to set the expiration time96 *97 * @param co Handle to the CachedObject98 */99publicvoid setCachedObject(CachedObject co);
100 }