View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.artifact.repository;
20  
21  /**
22   * Caches auxiliary data used during repository access like already processed metadata. The data in the cache is meant
23   * for exclusive consumption by the repository system and is opaque to the cache implementation.
24   *
25   * @author Benjamin Bentmann
26   */
27  @Deprecated
28  //
29  // Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
30  // this here, possibly indefinitely.
31  //
32  public interface RepositoryCache {
33  
34      /**
35       * Puts the specified data into the cache. <strong>Warning:</strong> The cache will directly save the provided
36       * reference. If the cached data is mutable, i.e. could be modified after being put into the cache, the caller is
37       * responsible for creating a copy of the original data and store the copy in the cache.
38       *
39       * @param request The repository request from which this cache was retrieved, must not be {@code null}.
40       * @param key The key to use associate the data with, must not be {@code null}.
41       * @param data The data to store in the cache, may be {@code null}.
42       */
43      void put(RepositoryRequest request, Object key, Object data);
44  
45      /**
46       * Gets the specified data from the cache. <strong>Warning:</strong> The cache will directly return the saved
47       * reference. If the cached data is to be modified after its retrieval, the caller is responsible to create a copy
48       * of the returned data and use this instead of the cache record.
49       *
50       * @param request The repository request from which this cache was retrieved, must not be {@code null}.
51       * @param key The key to use for lookup of the data, must not be {@code null}.
52       * @return The requested data or {@code null} if none was present in the cache.
53       */
54      Object get(RepositoryRequest request, Object key);
55  }