001 /* 002 Copyright (C) 2002 Laurent Martelli <laurent@aopsys.com> 003 004 This program is free software; you can redistribute it and/or modify 005 it under the terms of the GNU Lesser General Public License as 006 published by the Free Software Foundation; either version 2 of the 007 License, or (at your option) any later version. 008 009 This program is distributed in the hope that it will be useful, 010 but WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 GNU Lesser General Public License for more details. 013 014 You should have received a copy of the GNU Lesser General Public License 015 along with this program; if not, write to the Free Software 016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 017 018 package org.objectweb.jac.aspects.cache; 019 020 import org.objectweb.jac.core.rtti.AbstractMethodItem; 021 022 /** 023 * This aspect handle caching of method results. 024 */ 025 026 public interface CacheConf { 027 /** 028 * Specifies that the result of some methods should be cache. 029 * 030 * <p>If cached method is called twice on the same object with the 031 * same parameters, (according to equals()), the method won't be 032 * called the second time, and the result of the first invocation 033 * will be returned.</p> 034 * 035 * @param classExpr which classes' method to cache 036 * @param methodExpr which methods to cache 037 * 038 * @see #cacheWithTimeStamps(String,String,String) 039 */ 040 void cache(String classExpr, String methodExpr); 041 042 /** 043 * Specifies that the result of some methods should be cache. 044 * 045 * <p>Same as <code>cache()</code>, but the cache is invalidated 046 * if one of the parameters changed (according to the timestamp 047 * aspect) since the cached value was stored.</p> 048 * 049 * @param classExpr which classes' method to cache 050 * @param methodExpr which methods to cache 051 * @param stampsName name of the timestamp repository object to 052 * use (e.g "timestamps#0") 053 * 054 * @see #cache(String,String) 055 * @see org.objectweb.jac.aspects.timestamp.TimestampConf */ 056 void cacheWithTimeStamps( 057 String classExpr, String methodExpr, 058 String stampsName); 059 060 /** 061 * Tells the cache aspect that some parameters of a method should 062 * be ignored for all cache operations. 063 * 064 * <p>As far as the cache is concerned, they will be null.</p> 065 * 066 * @param method the method to configure 067 * @param ignored the indexes of parameters to be ignored 068 * (starting at 0) 069 */ 070 void setIgnoredParameters(AbstractMethodItem method, int[] ignored); 071 072 }