/** * 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()); }
/** * 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 }); }
@Override public String toString() { return cache.toString(); }
/** * Removes a repository info object from the cache. * * @param repositoryId the repository id */ public void remove(String repositoryId) { cache.remove(repositoryId); }
/** * 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); }