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 Type
Method
Description
static boolean
containsKey(String name)
Check if a cache exists for the given name.
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)
Gets or creates a cache instance by name, with the specified size (number of entries) and time to live.
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 JSCache
getInstance(String name, int size, int ttl, int mlt)
Gets or creates a cache instance by name, with the specified size (number of entries) and time to live.
static JSCache
Remove the cache corresponding to the given name.
static String
toString()
Returns a string representation of this cache.
Method Detail
Ax.cache.containsKey
-
static boolean Ax.cache.containsKey( string name )
- Info:
-
Check if a cache exists for the given name. - Parameters:
- name - the cache name
- Returns:
- boolean
Ax.cache.getInstance
-
static object Ax.cache.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:
- object
Ax.cache.getInstance
-
static object Ax.cache.getInstance( string name, smallint size )
- 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
- Returns:
- object
Ax.cache.getInstance
-
static object Ax.cache.getInstance( string name, smallint size, smallint 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:
- object
Ax.cache.getInstance
-
static object Ax.cache.getInstance( string name, smallint size, smallint ttl, smallint mlt )
- 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 (from last access)
- mlt - max live time (from creation)
- Returns:
- object
Ax.cache.remove
-
static object Ax.cache.remove( string name )
- Info:
-
Remove the cache corresponding to the given name. - Parameters:
- name - the cache name
- Returns:
- object
Ax.cache.toString
-
static string Ax.cache.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