public class ResourceCache extends Object
One of the most useful uses of a ResourceCache is to attribute properties and resources to a particular thread. This allows the safe re-use of data objects during frequently repeated tasks (such as those run by a server thread) thereby reducing the need to create and discard temporary objects. Using a ThreadPool for Thread re-use along with a ResourceCache can significantly improve the runtime performance of server applications.
A ResourceCache is generally better to use than a WeakCache for two reasons. One is that multiple resources can be attributed to an object, each with a distinct name. The other reason is that on a native Eve VM the ResourceCache is backed by a native implementation that makes accessing data from the cache very efficient.
Constructor and Description |
---|
ResourceCache() |
ResourceCache(int initialCapacity) |
ResourceCache(int initialCapacity,
float loadFactor) |
Modifier and Type | Method and Description |
---|---|
void |
cache(Object forWho,
Object obj) |
void |
clearCache(Object forWho,
Class type) |
Object |
get(Object forObject,
String resourceType) |
Object |
getCached(Object forWho,
Class type) |
Object |
getCached(Object forWho,
Class type,
boolean makeNew) |
void |
put(Object forObject,
String resourceType,
Object data) |
void |
remove(Object forObject,
String resourceType) |
void |
setupFor(Object forObject,
int initialCapacity,
float loadFactor) |
public ResourceCache()
public ResourceCache(int initialCapacity)
public ResourceCache(int initialCapacity, float loadFactor)
public void setupFor(Object forObject, int initialCapacity, float loadFactor)