Skip to content

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.

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.

ReturnsSignatureSummary
voidput(String uniqueId, ResourceData data) abstractKeeps data under uniqueId.
voidremove(String uniqueId) abstractForgets the data of uniqueId.
voidclear() abstractForgets every data; the next load of each input reads it again.
ResourceDataget(String uniqueId) abstractReturns the data of uniqueId, or null when the cache does not have it.
Collection<ResourceData>getDataList() abstractReturns the data the cache holds, as a new collection.

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.


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

Report a problem with this page