KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > cache > CacheConf


1 /*
2   Copyright (C) 2002 Laurent Martelli <laurent@aopsys.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.aspects.cache;
19
20 import org.objectweb.jac.core.rtti.AbstractMethodItem;
21
22 /**
23  * This aspect handle caching of method results.
24  */

25
26 public interface CacheConf {
27     /**
28      * Specifies that the result of some methods should be cache.
29      *
30      * <p>If cached method is called twice on the same object with the
31      * same parameters, (according to equals()), the method won't be
32      * called the second time, and the result of the first invocation
33      * will be returned.</p>
34      *
35      * @param classExpr which classes' method to cache
36      * @param methodExpr which methods to cache
37      *
38      * @see #cacheWithTimeStamps(String,String,String)
39      */

40     void cache(String JavaDoc classExpr, String JavaDoc methodExpr);
41
42     /**
43      * Specifies that the result of some methods should be cache.
44      *
45      * <p>Same as <code>cache()</code>, but the cache is invalidated
46      * if one of the parameters changed (according to the timestamp
47      * aspect) since the cached value was stored.</p>
48      *
49      * @param classExpr which classes' method to cache
50      * @param methodExpr which methods to cache
51      * @param stampsName name of the timestamp repository object to
52      * use (e.g "timestamps#0")
53      *
54      * @see #cache(String,String)
55      * @see org.objectweb.jac.aspects.timestamp.TimestampConf */

56     void cacheWithTimeStamps(
57         String JavaDoc classExpr, String JavaDoc methodExpr,
58         String JavaDoc stampsName);
59     
60     /**
61      * Tells the cache aspect that some parameters of a method should
62      * be ignored for all cache operations.
63      *
64      * <p>As far as the cache is concerned, they will be null.</p>
65      *
66      * @param method the method to configure
67      * @param ignored the indexes of parameters to be ignored
68      * (starting at 0)
69      */

70     void setIgnoredParameters(AbstractMethodItem method, int[] ignored);
71
72 }
73
Popular Tags