1 /***
2 * Copyright 2003-2010 Terracotta, Inc.
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 at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * 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 and
14 * limitations under the License.
15 */
16
17 package net.sf.ehcache.constructs.blocking;
18
19 /***
20 * A <code>CacheEntryFactory</code> with one additional method, <code>updateEntryValue((Serializable key, Serializable value)</code>
21 * which allows the cache entry to updated rather than replaced. This has the following
22 * potential benefits:
23 * <ul>
24 * <li>Where only part of the value needs to be updated, it is quicker
25 * <li>Memory use can be smoothed, which is useful for particularly large objects which are being
26 * refreshed contrinuously
27 * </ul>
28 *
29 * @author Greg Luck
30 * @version $Id: UpdatingCacheEntryFactory.html 13146 2011-08-01 17:12:39Z oletizi $
31 */
32 public interface UpdatingCacheEntryFactory extends CacheEntryFactory {
33 /***
34 * Perform an incremental update of data within a CacheEntry.
35 * Based on identification of dirty values within a CacheEntry
36 * Insert Update or Delete those entries based on the existing value.
37 * <p/>
38 * This method does not return a modified value, because it modifies the value passed into it, relying
39 * on the pass by reference feature of Java.
40 *
41 * Implementations of this method must be thread safe.
42 *
43 * @param key the cache Key
44 * @param value a value copied from the value that belonged to the Element in the cache. Value must be mutable
45 * @throws Exception
46 */
47 void updateEntryValue(Object key, Object value) throws Exception;
48
49 }
50