コード例 #1
0
  /**
   * Adds a repository info object to the cache.
   *
   * @param repositoryInfo the repository info object
   */
  public void put(RepositoryInfo repositoryInfo) {
    if ((repositoryInfo == null) || (repositoryInfo.getId() == null)) {
      return;
    }

    cache.put(repositoryInfo, repositoryInfo.getId());
  }
コード例 #2
0
  /**
   * Constructor.
   *
   * @param session the session object
   */
  public RepositoryInfoCache(BindingSession session) {
    assert session != null;

    int repCount =
        session.get(
            SessionParameter.CACHE_SIZE_REPOSITORIES,
            SessionParameterDefaults.CACHE_SIZE_REPOSITORIES);
    if (repCount < 1) {
      repCount = SessionParameterDefaults.CACHE_SIZE_REPOSITORIES;
    }

    cache = new CacheImpl("Repository Info Cache");
    cache.initialize(
        new String[] {
          MapCacheLevelImpl.class.getName() + " " + MapCacheLevelImpl.CAPACITY + "=" + repCount
        });
  }
コード例 #3
0
 @Override
 public String toString() {
   return cache.toString();
 }
コード例 #4
0
 /**
  * Removes a repository info object from the cache.
  *
  * @param repositoryId the repository id
  */
 public void remove(String repositoryId) {
   cache.remove(repositoryId);
 }
コード例 #5
0
 /**
  * Retrieves a repository info object from the cache.
  *
  * @param repositoryId the repository id
  * @return the repository info object or <code>null</code> if the object is not in the cache
  */
 public RepositoryInfo get(String repositoryId) {
   return (RepositoryInfo) cache.get(repositoryId);
 }