Class PublisherCache
- java.lang.Object
-
- com.sodius.oslc.client.requests.cache.PublisherCache
-
- All Implemented Interfaces:
ResourceCache<URI>
public class PublisherCache extends Object implements ResourceCache<URI>
A cache holding Publisher resources.- Since:
- 1.11.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PublisherCache
getInstance()
Returns the cache singleton instanceOptional<Publisher>
getPublisher(FriendProvider friendProvider, URI resourceURI)
Loads on demand the publisher corresponding to the given resource, if any.Publisher
getPublisher(URI uri)
Loads on demand the publisher resource.void
invalidate(URI uri)
Discards any cached value for keykey
.void
invalidateAll()
Discards all entries in the cache.void
update(URI uri, Publisher publisher)
Updates the cache with a new version of a publisher.
-
-
-
Method Detail
-
getInstance
public static PublisherCache getInstance()
Returns the cache singleton instance- Returns:
- the cache shared instance.
-
invalidate
public void invalidate(URI uri)
Description copied from interface:ResourceCache
Discards any cached value for keykey
.- Specified by:
invalidate
in interfaceResourceCache<URI>
- Parameters:
uri
- the key to remove in the cache.
-
invalidateAll
public void invalidateAll()
Description copied from interface:ResourceCache
Discards all entries in the cache.- Specified by:
invalidateAll
in interfaceResourceCache<URI>
-
update
public void update(URI uri, Publisher publisher)
Updates the cache with a new version of a publisher.This method should not need to be called in regular flows. It is automatically called when a resource is obtained using
GetPublisher
.- Parameters:
uri
- the publisher URIpublisher
- the publisher resource- Since:
- 3.1.0
-
getPublisher
public Publisher getPublisher(URI uri)
Loads on demand the publisher resource.- Parameters:
uri
- the publisher URI- Returns:
- the publisher
-
getPublisher
public Optional<Publisher> getPublisher(FriendProvider friendProvider, URI resourceURI)
Loads on demand the publisher corresponding to the given resource, if any.- Parameters:
friendProvider
- the provider of friend applications.resourceURI
- the resource URI.- Returns:
- the publisher declared by the friend application corresponding to the given resource,
or
Optional.empty()
if no such friend is found or it doesn't declare a publisher. - Since:
- 2.0.0
-
-