-
- All Implemented Interfaces:
-
com.facebook.cache.common.CacheKey
public class MultiCacheKey implements CacheKey
A cache key that wraps multiple cache keys.
Note:
{@code equals}and{@code hashcode}are implemented in a way that two MultiCacheKeys are equal if and only if the underlying list of cache keys is equal. That implies AllOf semantics. Unfortunately, it is not possible to implement AnyOf semantics for{@code equals}because the transitivity requirement wouldn't be satisfied. I.e. we would have: {A} = {A, B}, {A, B} = {B}, but {A} != {B}.It is fine to use this key with AnyOf semantics, but one should be aware of
{@code equals}and{@code hashcode}behavior, and should implement AnyOf logic manually.
-
-
Constructor Summary
Constructors Constructor Description MultiCacheKey(List<CacheKey> cacheKeys)
-
Method Summary
Modifier and Type Method Description List<CacheKey>getCacheKeys()StringtoString()booleanequals(@Nullable() Object o)inthashCode()booleancontainsUri(Uri uri)Returns true if this key was constructed from this Uri. StringgetUriString()Returns a string representation of the URI at the heart of the cache key. booleanisResourceIdForDebugging()Returns true if this key was constructed from a resource ID. -
-
Method Detail
-
getCacheKeys
List<CacheKey> getCacheKeys()
-
hashCode
int hashCode()
-
containsUri
boolean containsUri(Uri uri)
Returns true if this key was constructed from this Uri.
Used for cases like deleting all keys for a given uri.
-
getUriString
String getUriString()
Returns a string representation of the URI at the heart of the cache key. In cases of multiplekeys being contained, the first is returned.
-
isResourceIdForDebugging
boolean isResourceIdForDebugging()
Returns true if this key was constructed from a resource ID. If this ever changes, the diskcache entries corresponding to this cache key would be invalidated.
-
-
-
-