public class DefaultResourceCacheStrategy extends Object implements ResourceCacheStrategy
ResourceCacheStrategy
manages reading and writing to/from a Cache
. This
implementation also invalidates an object's cache when DELETE
and other mutating operations are called.
Key Points:
_link.self.href
is cachedResourceHrefResolver
will be consulted if a Resource does NOT have a @{code _link.self.href} propertycache
method with a DELETE
action will also remove that object from the cacheUPDATE
call to the cache
method, that has a _parent_ set in the ResourceDataRequest
will also remove the parent from the cacheConstructor and Description |
---|
DefaultResourceCacheStrategy(ResourceHrefResolver hrefResolver,
CacheResolver cacheResolver) |
Modifier and Type | Method and Description |
---|---|
void |
cache(ResourceDataRequest request,
ResourceDataResult result)
Cache the
result data that was returned based on the request . |
ResourceDataResult |
readFromCache(ResourceDataRequest request)
Attempts to retrieve data from the cache based on the
request . |
public DefaultResourceCacheStrategy(ResourceHrefResolver hrefResolver, CacheResolver cacheResolver)
public void cache(ResourceDataRequest request, ResourceDataResult result)
ResourceCacheStrategy
result
data that was returned based on the request
.cache
in interface ResourceCacheStrategy
request
- the data requestresult
- the result to be cachedpublic ResourceDataResult readFromCache(ResourceDataRequest request)
ResourceCacheStrategy
request
. If the object is NOT found in the cache,
null
is returned.readFromCache
in interface ResourceCacheStrategy
request
- the source request used to query the cache.Copyright © 2017–2023 Okta. All rights reserved.