aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/signing/ssh/CachingSigningKeyDatabase.java
blob: 4d2d8b6797f35a320da22d77d4b3cb07240850ce (plain)
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
/*
 * Copyright (C) 2024, Thomas Wolf <twolf@apache.org> and others
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * https://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
package org.eclipse.jgit.signing.ssh;

/**
 * A {@link SigningKeyDatabase} that caches data.
 * <p>
 * A signing key database may be used to check keys frequently; it may thus need
 * to cache some data and it may need to cache data per repository. If an
 * implementation does cache data, it is responsible itself for refreshing that
 * cache at appropriate times. Clients can control the cache size somewhat via
 * {@link #setCacheSize(int)}, although the meaning of the cache size (i.e., its
 * unit) is left undefined here.
 * </p>
 *
 * @since 7.1
 */
public interface CachingSigningKeyDatabase extends SigningKeyDatabase {

	/**
	 * Retrieves the current cache size.
	 *
	 * @return the cache size, or -1 if this database has no cache.
	 */
	int getCacheSize();

	/**
	 * Sets the cache size to use.
	 *
	 * @param size
	 *            the cache size, ignored if this database does not have a
	 *            cache.
	 * @throws IllegalArgumentException
	 *             if {@code size < 0}
	 */
	void setCacheSize(int size);

	/**
	 * Discards any cached data. A no-op if the database has no cache.
	 */
	void clearCache();
}