All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cds.reflect.impl.CdsModelArtifactsCache Maven / Gradle / Ivy

There is a newer version: 3.6.1
Show newest version
package com.sap.cds.reflect.impl;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.google.common.hash.HashCode;
import com.sap.cds.reflect.CdsAnnotation;

/**
 * Singleton that caches cds model artifacts.
 */
public class CdsModelArtifactsCache {

	private static final CdsModelArtifactsCache instance = new CdsModelArtifactsCache();

	private final Cache> annotations;

	private CdsModelArtifactsCache() {
		annotations = Caffeine.newBuilder().maximumSize(10_000).weakValues().build();
	}

	public static CdsModelArtifactsCache getInstance() {
		return instance;
	}

	public static void invalidateAll() {
		instance.annotations.invalidateAll();
	}

	public Cache> getAnnotations() {
		return annotations;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy