The following document illustrates several basic JCS configurations. As you'll see, using JCS can be as simple as creating a single memory cache for you application. However, with a few configuration changes, you can quickly enable some distributed caching features that can scale your application even further.
Configuring the JCS can be as simple as your needs. The most basic configuration would be a pure memory cache where every region takes the default values. The complete configuration file (cache.ccf) could look like this:
If you want to add memory shrinking then you can add these lines:
Adding a disk cache is as simple as telling it what folder to use. It is recommended that you add a disk cache. If you want to add a disk cache to your default parameters, then (1) add this to the bottom of the file to create the auxiliary:
and (2) change the first line to:
If you want to predefine a specific region, say called
testCache1
, then add these lines:
If you want to add a lateral cache for distribution (the TCP Lateral Auxiliary is recommended), then add these lines to the bottom of the file to define the auxiliary:
See the TCP Lateral documentation for more information. If you
want to set up testCache1
to use this, then change
the definition to:
Auxiliary definitions are like log4j appenders, they are defined and then associated with a region like a log4j category.
The order of configuration file is unimportant, though you should try to keep it organized for your own sake.
Configuration is being refactored and is subject to change. It should only become easier.
The complete file from above would look like this: