1 Cache

Class Ax.cache


Global script cache for the JVM Permits all applications running on a server instance to share a common javascript cache. The need comes from the following example: We have a REST endpoint backed with javascript and we need to keep in memory a ResultSet. We can do it using the db.connection via execute query and let the connection cache solves it. But we still need to get a connection from pool every time we need to access the cache. So we are doing:

Method Summary

Modifier and TypeMethodDescription
static JSCache getInstance(String name)Gets or creates a cache instance by name, with size (number of entries) 128 and time to live 0.
static JSCache getInstance(String name, int size, int ttl)Gets or creates a cache instance by name, with the specified size (number of entries) and time to live.
static String toString()Returns a string representation of this cache.

Method Detail

getInstance

static JSCache getInstance(String name)
Info:
Gets or creates a cache instance by name, with size (number of entries) 128 and time to live 0.
Parameters:
name - name given to the cache instance
Returns:
JSCache instance

getInstance

static JSCache getInstance(String name, int size, int ttl)
Info:
Gets or creates a cache instance by name, with the specified size (number of entries) and time to live.
Parameters:
name - name given to the cache instance
size - size in entries
ttl - time to live in seconds
Returns:
JSCache instance

toString

static String toString()
Info:
Returns a string representation of this cache. The string representation consists of a list of key-value mappings (in no particular order) enclosed in braces ("{}"). Adjacent mappings are separated by the characters ", " (comma and space). Each key-value mapping is rendered as the key (cache name) followed by an equals sign ("=") followed by the associated value.
Returns:
string containing cahe information.