Class SerializableCacheKey
java.lang.Object
com.sap.cloud.sdk.cloudplatform.cache.SerializableCacheKey
- All Implemented Interfaces:
GenericCacheKey<SerializableCacheKey,,Serializable> Serializable
public final class SerializableCacheKey
extends Object
implements GenericCacheKey<SerializableCacheKey,Serializable>, Serializable
SerializableCacheKey with either global visibility, tenant isolation, or tenant and principal isolation. The cache
key components are guaranteed to be serializable.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionappend(Iterable<Serializable> objects) Appends the given Objects to this instance.booleanGetter for the list of additional cache key components.io.vavr.control.Option<String>Getter for the name of the principal for which the key is used.io.vavr.control.Option<String>Getter for the Id of the tenant for which the key is used.inthashCode()static SerializableCacheKeyConstructs aCacheKeyfor the given tenant and principal identifier, independent of whether they arenullor not.static SerializableCacheKeyConstructs aSerializableCacheKeyfor the given tenant and principal identifier, independent of whether they arenullor not.toString()
-
Method Details
-
getTenantId
Description copied from interface:GenericCacheKeyGetter for the Id of the tenant for which the key is used.- Specified by:
getTenantIdin interfaceGenericCacheKey<SerializableCacheKey,Serializable> - Returns:
- The tenant identifier.
-
getPrincipalId
Description copied from interface:GenericCacheKeyGetter for the name of the principal for which the key is used.- Specified by:
getPrincipalIdin interfaceGenericCacheKey<SerializableCacheKey,Serializable> - Returns:
- The principal identifier.
-
append
@Nonnull public SerializableCacheKey append(@Nonnull Iterable<Serializable> objects) throws IllegalArgumentException Description copied from interface:GenericCacheKeyAppends the given Objects to this instance. In order to compare cache keys,Object.equals(Object)andObject.hashCode()are used. The given objects must not benull.- Specified by:
appendin interfaceGenericCacheKey<SerializableCacheKey,Serializable> - Parameters:
objects- Additional objects that should be used to identify a cache key.- Returns:
- This instance with the objects added.
- Throws:
IllegalArgumentException- If any of the given objects isnull.
-
of
@Nonnull public static SerializableCacheKey of(@Nullable String tenantId, @Nullable String principalId) Constructs aSerializableCacheKeyfor the given tenant and principal identifier, independent of whether they arenullor not. This provides the highest flexibility for defining different levels of isolation.- Parameters:
tenantId- The identifier of the tenant. Ifnull, there is no tenant isolation.principalId- The identifier of the principal. Ifnull, there is no principal isolation.- Returns:
- A new
CacheKeyconstructed from the given tenant and principal identifier.
-
of
@Nonnull public static SerializableCacheKey of(@Nullable Tenant tenant, @Nullable Principal principal) Constructs aCacheKeyfor the given tenant and principal identifier, independent of whether they arenullor not. This provides the highest flexibility for defining different levels of isolation.- Parameters:
tenant- The tenant. Ifnull, there is not tenant isolation.principal- The principal. Ifnull, there is no principal isolation.- Returns:
- A new
CacheKeyconstructed from the given tenant and principal identifier.
-
equals
-
hashCode
public int hashCode() -
toString
-
getComponents
Description copied from interface:GenericCacheKeyGetter for the list of additional cache key components.- Specified by:
getComponentsin interfaceGenericCacheKey<SerializableCacheKey,Serializable> - Returns:
- The list of additional cache key components.
-