org.sonatype.nexus.proxy.repository.Repository.evictUnusedItems()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.sonatype.nexus.proxy.repository.Repository.evictUnusedItems方法的一些代码示例,展示了Repository.evictUnusedItems的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.evictUnusedItems方法的具体详情如下:
包路径:org.sonatype.nexus.proxy.repository.Repository
类名称:Repository
方法名:evictUnusedItems

Repository.evictUnusedItems介绍

[英]Evicts items that were last used before timestamp.
[中]收回上次在时间戳之前使用的项目。

代码示例

代码示例来源:origin: org.sonatype.nexus/nexus-app

@Deprecated
public Collection<String> evictAllUnusedProxiedItems( ResourceStoreRequest req, long timestamp )
  throws IOException
{
  ArrayList<String> result = new ArrayList<String>();
  for ( Repository repository : repositoryRegistry.getRepositories() )
  {
    if ( LocalStatus.IN_SERVICE.equals( repository.getLocalStatus() ) )
    {
      result.addAll( repository.evictUnusedItems( req, timestamp ) );
    }
  }
  return result;
}

代码示例来源:origin: org.sonatype.nexus/nexus-app

@Override
protected Collection<String> doRun()
  throws Exception
{
  ResourceStoreRequest req = new ResourceStoreRequest( "/" );
  long olderThan = System.currentTimeMillis() - ( getEvictOlderCacheItemsThen() * A_DAY );
  if ( getRepositoryId() != null )
  {
    return getRepositoryRegistry().getRepository( getRepositoryId() ).evictUnusedItems( req, olderThan );
  }
  else
  {
    ArrayList<String> result = new ArrayList<String>();
    for ( Repository repository : getRepositoryRegistry().getRepositories() )
    {
      result.addAll( repository.evictUnusedItems( req, olderThan ) );
    }
    return result;
  }
}

代码示例来源:origin: org.sonatype.nexus/nexus-proxy

@Override
public Collection<String> evictUnusedItems( ResourceStoreRequest request, final long timestamp )
{
  if ( !getLocalStatus().shouldServiceRequest() )
  {
    return Collections.emptyList();
  }
  getLogger().info(
    String.format( "Evicting unused items from group repository %s from path \"%s\"",
      RepositoryStringUtils.getHumanizedNameString( this ), request.getRequestPath() ) );
  HashSet<String> result = new HashSet<String>();
  // here, we just iterate over members and call evict
  final List<Repository> members = getMemberRepositories();
  for ( Repository repository : members )
  {
    result.addAll( repository.evictUnusedItems( request, timestamp ) );
  }
  eventBus().post( new RepositoryEventEvictUnusedItems( this ) );
  return result;
}

相关文章