Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c3cbd1df19fd5a77638186f7aaf53560b52b164c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*******************************************************************************
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.core;

/**
 * A cache that is associated with a synchronization that allows clients
 * to cache synchronization state related to their model for the duration of the
 * operation. When the context is disposed, the cache will be disposed and any
 * listeners notified.
 *
 * @since 3.2
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface ICache {

	/**
	 * Cache the given object with this context.
	 * @param name the name that uniquely identifies the object
	 * @param value the value to be cached.
	 */
	void put(String name, Object value);

	/**
	 * Retrieve an object that has been cached with the context
	 * @param name the name of the object
	 * @return the object associated with the name or <code>null</code>
	 */
	Object get(String name);

	/**
	 * Remove the named object from the cache
	 * @param name the name
	 */
	void remove(String name);

	/**
	 * Add a listener to the cache that will receive notification
	 * when the cache is disposed. Adding a listener that has already
	 * been added has no effect.
	 * @param listener the listener to add
	 */
	void addCacheListener(ICacheListener listener);

	/**
	 * Remove the listener. Removing a listener that is not registered
	 * has no effect.
	 * @param listener the listener to remove
	 * @since 3.3
	 */
	void removeCacheListener(ICacheListener listener);

	/**
	 * Remove the listener. Removing a listener that is not registered
	 * has no effect.
	 * @param listener the listener to remove
	 * @deprecated use {@link #removeCacheListener(ICacheListener)}
	 */
	void removeDisposeListener(ICacheListener listener);

}

Back to the top