private static <K, V> Cache<K, V> newCache(int cacheMaxSize, long cacheEvictTimeoutMillis) { Conditions.checkExpressionFailOnTrue( cacheMaxSize <= 0, "Token Cache max size must be greater than 0"); Conditions.checkExpressionFailOnTrue( cacheEvictTimeoutMillis > MAX_TOKEN_CACHE_EVICT_TIMEOUT_MILLIS, "Token cache evict timeout exceeds max - [%s]", Lib.asTimeString(MAX_TOKEN_CACHE_EVICT_TIMEOUT_MILLIS)); Conditions.checkExpressionFailOnTrue( cacheEvictTimeoutMillis <= 0, "Token cache evict timeout must be greater than 0"); return CacheBuilder.newBuilder() // .maximumSize(cacheMaxSize) // .expireAfterWrite(cacheEvictTimeoutMillis, TimeUnit.MILLISECONDS) // .build(); }
@Override public ArtifactData create(IOseeBranch branch, IArtifactType token, String guid, long uuid) throws OseeCoreException { Conditions.checkNotNull(branch, "branch"); Conditions.checkExpressionFailOnTrue( artifactCache.isAbstract(token), "Cannot create an instance of abstract type [%s]", token); String guidToSet = idFactory.getUniqueGuid(guid); Conditions.checkExpressionFailOnTrue( !GUID.isValid(guidToSet), "Invalid guid [%s] during artifact creation [type: %s]", guidToSet, token); VersionData version = objectFactory.createDefaultVersionData(); version.setBranchId(branch.getUuid()); ModificationType modType = RelationalConstants.DEFAULT_MODIFICATION_TYPE; ArtifactData artifactData = objectFactory.createArtifactData(version, (int) uuid, token, modType, guidToSet); return artifactData; }