Skip to main content
A Open Source Solution
Home Download Support Configuration Development ImagoX

Define the desired cache configuration. There are several cache options to choose from. The various types of caches are explained here:

No Cache

This configuration is not recommended. Without a cache is required to generate complete transforms for each request. A well-tuned cache can significantly increase performance.

cache=org.xenei.util.cache.NoCache
Defines a cache that does nothing. It always accepts entries and never has anything cached.
Back to top

Memory Cache

is shipped with the Memory Cache enabled.

cache=org.xenei.util.cache.memcache.MemoryCache
Specifies the MemoryCache as the cache.
cache.cacheclass=java.util.HashMap
Specifies that the cache should use the standard HashMap to store data internally. Any class that implements java.util.Map may be used.
cache.reaper.maxage=30
The maximum age in minutes of a cache entry before it is considered stale and removed.
cache.reaper.period=45
The period in minutes between sweeps of the cache for stale objects. This number should be larger than the maxage parameter.
cache.reaper.priority=1
The thread priority that the reaper will run with. If this is not set then the priority of the scheduler will be used.
cache.mem.min=1
The minimum free heap in MBs. This is the number of MBs required to be free when the cache is operating. If the free memory drops below this number the cache attempts an emergency clean of stale objects until the minimum free memory is achieved or the cache is disabled.
cache.mem.max=4
This is the maximum memory used by the application. It is not possible to differentiate between cache and non-cache items. If this limit is exceeded then an emergency clean of stale objects is attempted.
cache.lock.maxage=10
The maximum age of a cache lock in seconds. If a lock exceeds this age it is assumed to be abandoned and may be broken.
cache.lock.wait.count=5
The maximum number of times a thread should wait for a cache lock before giving up and proceeding to rebuild the object. If this is set too low the cache will build unnecessary objects, if too high the system will slow down waiting for locks when it could rebuild the object faster.
cache.lock.wait.time=100
The number of timer ticks in milliseconds the thread should wait between attempts to get a cache lock.
Back to top

DB Cache

The DBCache utilizes a database. This can make it easy for multiple servers to synchronize their caches. This can be particularly useful if is being run in a clustered environment.

cache=org.xenei.util.cache.dbcache.DBCache
Use the DBCache.
cache.driver=com.mysql.jdbc.Driver
The JDBC driver to use. This must be a driver and database supported by LDBC.
cache.url=jdbc:mysql://db.xenei.org/imago
The URL for the database.
cache.user=imago
The user ID for the database.
cache.password=imago
The password for the database.
cache.reaper.period=15
The period in hours between sweeps of the cache for expired objects. In the DB cache an object is expired if it has changed. The reaper reads and validates every object in the table.
cache.reaper.priority=1
The thread priority the reaper will run with. If this is not set the priority of the scheduler will be used.
cache.lock.maxage=10
The maximum age of a cache lock in seconds. If a lock exceeds this age it is assumed to be abandoned and may be broken.
cache.lock.wait.count=5
The maximum number of times a thread should wait for a cache lock before giving up and proceeding to rebuild the object. If this is set too low the cache will build unnecessary objects, if set too high the system will slow down waiting for locks when it could rebuild the object faster.
cache.lock.wait.time=100
The number of timer ticks in milliseconds the thread should wait between attempts to get a cache lock.
Back to top

Slow Cache

The slow cache does not perform caching itself. It is used to wrap a slower caching implementation. For example a remote database cache may be too slow for regular operation but by wrapping it in a slow cache there is some speed improvement.

cache=org.xenei.util.cache.slowcache.SlowCache
Use the slow cache wrapper.
cache.wraps=org.xenei.util.cache.dbcache.DBCache
Define a wrapping of a database cache.
cache.wraps.driver=com.mysql.jdbc.Driver
cache.wraps.url=jdbc:mysql://db.xenei.org/imago
cache.wraps.user=imago
cache.wraps.password=imago
cache.wraps.reaper.period=15
cache.wraps.reaper.priority=1
cache.wraps.lock.maxage=10
cache.wraps.lock.wait.count=5
cache.wraps.lock.wait.time=100
The DB cache options.
Back to top

Xenei Cache

The Xenei Cache is a two-level cache mechanism. This is particularly useful if you want to have a shallow cache for frequently used objects and a deeper cache for less frequently used objects, such as an in-memory cache backed by a database cache.

cache=org.xenei.util.cache.xeneicache.XeneiCache
Use the Xenei Cache.
cache.synchronizedlocks=false
Synchronized locks requires that both level1 and level2 caches be locked before a lock is returned. Otherwise the first level lock is tried and if it succeeds the second level is tried; regardless of the result of the second level lock the lock is returned.
cache.level1=org.xenei.util.cache.memcache.MemoryCache
Level 1 uses the memory cache.
cache.level1.cacheclass=java.util.HashMap
cache.level1.reaper.maxage=30
cache.level1.reaper.period=45
cache.level1.reaper.priority=1
cache.level1.mem.min=1
cache.level1.mem.max=4
cache.level1.lock.maxage=10
cache.level1.lock.wait.count=5
cache.level1.lock.wait.time=100
The memory cache definition.
cache.level2=org.xenei.util.cache.slowcache.SlowCache
Level 2 uses the slow cache wrapper.
cache.level2.wraps=org.xenei.util.cache.dbcache.DBCache
It is wrapping a database cache.
cache.level2.wraps.driver=com.mysql.jdbc.Driver
cache.level2.wraps.url=jdbc:mysql://db.xenei.org/imago
cache.level2.wraps.user=imago
cache.level2.wraps.password=imago
cache.level2.wraps.reaper.period=15
cache.level2.wraps.reaper.priority=1
cache.level2.wraps.lock.maxage=10
cache.level2.wraps.lock.wait.count=5
cache.level2.wraps.lock.wait.time=100
The DB cache options.
Back to top
All trademarks and copyrights are the property of their respective owners.
Copyright © 2002-2004 by Xenei.com, All Rights Reserved
OpenSource.org
AnyBrowser.org
Xenei.org - Open Source Solutions