cle_clock
Home > wikikonf >  was/actions/by kikonf > cache







Cache

print

Action : was.cache   (Category : was, Name : cache, By : kikonf)
Complete Name : was.cache.by.kikonf
Version : 5.0        License : Modified BSD License

Purpose of the was category :
Easy to customize. This category use in background the wsadmin command in jython mode (through AdminConfig, AdminControl and AdminTask), to drive WebSphere Application Server configuration.
You can use it to manage the whole WebSphere architecture.

Purpose of this cache plugin : Creates a new ObjectCacheInstance

The following shows in what part of a typical Architecture is likely to be found, the Resource configured by Action : was.cache





Creates a new ObjectCacheInstance.

1. ObjectCacheInstance

A Cache Instance is is a memory space where to store arbitrary objects.
The Cache is then available to the J2EE Applications inside the JVM.

Note:
-----
a) A default ObjectCacheInstance called the "default dynamic cache Instance" is enabled
by default on every WAS (TM) JVM, its JNDI name is: "services/cache/distributedmap".
b) J2EE Applications can explicitly declare ObjectCacheInstance using a file named: "cacheinstances.properties" 
into their EAR file, so you may want to disable this functionality if this is not what you expect.

2. Replication

Cache Instances can also be distributed (replicated) accross multiple JVMs.
This allows multiple JVMs to share objects from the "same" Caches Instances.

3. Using ObjectCacheInstance with WebSphere Application Server (TM)

Two interfaces are provided to handle ObjectCacheInstance :
the DistributedMap and DistributedObjectCache interfaces.

One J2EE Application can use an ObjectCacheInstance in the following conditions :

* Directly using the Cache Instance's JNDI Name

InitialContext ctx = new InitialContext();
DistributedMap mycache = (DistributedMap)ctx.lookup("services/cache/mycache");

or

InitialContext ctx = new InitialContext();
DistributedObjectCache mycache = (DistributedObjectCache)ctx.lookup("services/cache/mycache");

* Indirectly using the java:comp/env's JNDI Name

The resource must be declared into the descriptor file.
e.g. web.xml :
<resource-ref>
.   <res-ref-name>cache/invoices</res-ref-name>
.   <res-type>com.ibm.websphere.cache.DistributedMap</res-type>
.   <res-auth>Container</res-auth>
.   <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

This resource may be used into the Application like this :
InitialContext ctx = new InitialContext();
DistributedMap invoices =(DistributedMap)ctx.lookup("java:comp/env/cache/invoices");


Trademarks:
___________

WAS and WebSphere Application Server are registred trademarks of International Business Machines Corporation.
JVM and Java are registred trademarks of Oracle and/or its affiliates.
Other names may be trademarks of their respective owners.



Trademarks :
  • "IBM", "WebSphere", "WebSphere Aplication Server", "WAS" are registred trademarks of International Business Machines Corporation.
  • "Java" and "JVM" are a registred trademarks of Oracle and/or its affiliates.
  • Other names may be trademarks of their respective owners.

Copyright © 2011 - Patrick Placidoux, Hélène Malamoud