Add getContentMetadata and applyContentMetadataMutations to Cache interface
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=189186679
This commit is contained in:
parent
234d611175
commit
d9f2989c9e
@ -238,4 +238,23 @@ public interface Cache {
|
|||||||
* com.google.android.exoplayer2.C#LENGTH_UNSET} otherwise.
|
* com.google.android.exoplayer2.C#LENGTH_UNSET} otherwise.
|
||||||
*/
|
*/
|
||||||
long getContentLength(String key);
|
long getContentLength(String key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies {@code mutations} to the {@link ContentMetadata} for the given key. A new {@link
|
||||||
|
* CachedContent} is added if there isn't one already with the given key.
|
||||||
|
*
|
||||||
|
* @param key The cache key for the data.
|
||||||
|
* @param mutations Contains mutations to be applied to the metadata.
|
||||||
|
* @throws CacheException If an error is encountered.
|
||||||
|
*/
|
||||||
|
void applyContentMetadataMutations(String key, ContentMetadataMutations mutations)
|
||||||
|
throws CacheException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a snapshot of the {@link ContentMetadata} for the given key.
|
||||||
|
*
|
||||||
|
* @param key The cache key for the data.
|
||||||
|
* @return A snapshot of the {@link ContentMetadata} for the given key.
|
||||||
|
*/
|
||||||
|
ContentMetadata getContentMetadataSnapshot(String key);
|
||||||
}
|
}
|
||||||
|
@ -412,26 +412,14 @@ public final class SimpleCache implements Cache {
|
|||||||
return index.getContentLength(key);
|
return index.getContentLength(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Applies {@code mutations} to the {@link ContentMetadata} for the given key. A new {@link
|
|
||||||
* CachedContent} is added if there isn't one already with the given key.
|
|
||||||
*
|
|
||||||
* @param key The cache key for the data.
|
|
||||||
* @param mutations Contains mutations to be applied to the metadata.
|
|
||||||
* @throws CacheException If an error is encountered.
|
|
||||||
*/
|
|
||||||
public void applyContentMetadataMutations(String key, ContentMetadataMutations mutations)
|
public void applyContentMetadataMutations(String key, ContentMetadataMutations mutations)
|
||||||
throws CacheException {
|
throws CacheException {
|
||||||
index.applyContentMetadataMutations(key, mutations);
|
index.applyContentMetadataMutations(key, mutations);
|
||||||
index.store();
|
index.store();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns a snapshot of the {@link ContentMetadata} for the given key.
|
|
||||||
*
|
|
||||||
* @param key The cache key for the data.
|
|
||||||
* @return A snapshot of the {@link ContentMetadata} for the given key.
|
|
||||||
*/
|
|
||||||
public ContentMetadata getContentMetadataSnapshot(String key) {
|
public ContentMetadata getContentMetadataSnapshot(String key) {
|
||||||
return index.getContentMetadataSnapshot(key);
|
return index.getContentMetadataSnapshot(key);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user