IResourceCache
interface IResourceCache
Known subtypes: MemoryResourceCache
Package: dev.joid.lib.resource.cache · Module: core · Source: IResourceCache.java
Where a ResourceBuilder keeps the data of its resources by id, so that two loads of the same input share it.
Description
Section titled “Description”MemoryResourceCache is the default; implement this interface to keep data under another policy, and give it to ResourceBuilder.cache.
It is called from the render thread and from loading threads: make it thread-safe.
Learn more
Section titled “Learn more”Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
void | put(String uniqueId, ResourceData data) abstract | Keeps data under uniqueId. |
void | remove(String uniqueId) abstract | Forgets the data of uniqueId. |
void | clear() abstract | Forgets every data; the next load of each input reads it again. |
ResourceData | get(String uniqueId) abstract | Returns the data of uniqueId, or null when the cache does not have it. |
Collection<ResourceData> | getDataList() abstract | Returns the data the cache holds, as a new collection. |
Method details
Section titled “Method details”void put(String uniqueId, ResourceData data) abstract
Keeps data under uniqueId.
remove
Section titled “remove”void remove(String uniqueId) abstract
Forgets the data of uniqueId.
void clear() abstract
Forgets every data; the next load of each input reads it again.
ResourceData get(String uniqueId) abstract
Returns the data of uniqueId, or null when the cache does not have it.
getDataList
Section titled “getDataList”Collection<ResourceData> getDataList() abstract
Returns the data the cache holds, as a new collection.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
