X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2FRepositoryCache.java;fp=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2FRepositoryCache.java;h=736384414adfd7ba706c7358b875b262017423c9;hb=825d60c5348dbe3f5be25b0bccf7bdebfe694219;hp=0000000000000000000000000000000000000000;hpb=5e991fff5cba01858dcc5747a27e637325bc5c8e;p=gpl%2Fargeo-jcr.git diff --git a/org.argeo.slc.repo/src/org/eclipse/aether/RepositoryCache.java b/org.argeo.slc.repo/src/org/eclipse/aether/RepositoryCache.java new file mode 100644 index 0000000..7363844 --- /dev/null +++ b/org.argeo.slc.repo/src/org/eclipse/aether/RepositoryCache.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2010, 2014 Sonatype, Inc. + * 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: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether; + +/** + * Caches auxiliary data used during repository access like already processed metadata. The data in the cache is meant + * for exclusive consumption by the repository system and is opaque to the cache implementation. Note: + * Actual cache implementations must be thread-safe. + * + * @see RepositorySystemSession#getCache() + */ +public interface RepositoryCache +{ + + /** + * Puts the specified data into the cache. It is entirely up to the cache implementation how long this data will be + * kept before being purged, i.e. callers must not make any assumptions about the lifetime of cached data. + *

+ * Warning: The cache will directly save the provided reference. If the cached data is mutable, i.e. could + * be modified after being put into the cache, the caller is responsible for creating a copy of the original data + * and store the copy in the cache. + * + * @param session The repository session during which the cache is accessed, must not be {@code null}. + * @param key The key to use for lookup of the data, must not be {@code null}. + * @param data The data to store in the cache, may be {@code null}. + */ + void put( RepositorySystemSession session, Object key, Object data ); + + /** + * Gets the specified data from the cache. + *

+ * Warning: The cache will directly return the saved reference. If the cached data is to be modified after + * its retrieval, the caller is responsible to create a copy of the returned data and use this instead of the cache + * record. + * + * @param session The repository session during which the cache is accessed, must not be {@code null}. + * @param key The key to use for lookup of the data, must not be {@code null}. + * @return The requested data or {@code null} if none was present in the cache. + */ + Object get( RepositorySystemSession session, Object key ); + +}