001package org.apache.maven.artifact.repository;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022/**
023 * Caches auxiliary data used during repository access like already processed metadata. The data in the cache is meant
024 * for exclusive consumption by the repository system and is opaque to the cache implementation.
025 *
026 * @author Benjamin Bentmann
027 */
028@Deprecated
029//
030// Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
031// this here, possibly indefinitely.
032//
033public interface RepositoryCache
034{
035
036    /**
037     * Puts the specified data into the cache. <strong>Warning:</strong> The cache will directly save the provided
038     * reference. If the cached data is mutable, i.e. could be modified after being put into the cache, the caller is
039     * responsible for creating a copy of the original data and store the copy in the cache.
040     *
041     * @param request The repository request from which this cache was retrieved, must not be {@code null}.
042     * @param key The key to use associate the data with, must not be {@code null}.
043     * @param data The data to store in the cache, may be {@code null}.
044     */
045    void put( RepositoryRequest request, Object key, Object data );
046
047    /**
048     * Gets the specified data from the cache. <strong>Warning:</strong> The cache will directly return the saved
049     * reference. If the cached data is to be modified after its retrieval, the caller is responsible to create a copy
050     * of the returned data and use this instead of the cache record.
051     *
052     * @param request The repository request from which this cache was retrieved, must not be {@code null}.
053     * @param key The key to use for lookup of the data, must not be {@code null}.
054     * @return The requested data or {@code null} if none was present in the cache.
055     */
056    Object get( RepositoryRequest request, Object key );
057
058}