Title: RE: Customizing if a persistente object use the cache or not

Hello,

We have created a new implementation for the object's cache.
With this implementation, we can choose which object must be in cache or not.

The implementation is : aston.solution.ojb.cache.ObjectCacheImpl

To achieve this we have added 2 customs attributes in the repository_user.xml at the class descriptor level :

If you don't specify those customs attributes their default values are cache=false and experiation=-1 (infinite life)
Note : the expiration's value is in second

example :

<class-descriptor
 class="aston.bank.domain.account.AccountType"
 table="ACCOUNT_TYPE"> 
         
  <field-descriptor id="1"
   name="id"
   column="ACT_ID"
   jdbc-type="INTEGER"
   primarykey="true"
   autoincrement="true"
  />
  
  <field-descriptor id="2"
   name="label"
   column="ACT_LABEL"
   jdbc-type="VARCHAR"
  />
     
  <field-descriptor id="3"
   name="code"
   column="ACT_CODE"
   jdbc-type="VARCHAR"
  />
    
  <attribute
   attribute-name="cache"
   attribute-value="true"
  />
  <attribute
   attribute-name="expiration"
   attribute-value="120"
  />
      
</class-descriptor>  

We have also added a servlet which allow you to watch the objects in the cache.
The init parameters for the servlet are the following in the web.xml :

<!-- supervision Servlet for the OJB cache -->
  <servlet>
    <servlet-name>ServletViewer</servlet-name>
    <servlet-class>aston.solution.ojb.cache.supervision.ServletViewer</servlet-class>
    <init-param>
      <param-name>active</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>refresh</param-name>
      <param-value>5</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
  </servlet>

  <!-- Supervision Servlet Mapping --> 
  <servlet-mapping>
    <servlet-name>ServletViewer</servlet-name>
    <url-pattern>/ServletViewer</url-pattern>
  </servlet-mapping>

Please don't hesitate to give us some feedback about our simple implementation



-----Message d'origine-----
De : CLARAMONTE Jean-Baptiste
Envoy� : jeudi 23 janvier 2003 16:34
� : OJB Users List (E-mail)
Objet : Customizing if a persistente object use the cache or not


Hello,

I would like to know if there is a way to customize for each object if it
can or can't be in cache ?
Do you think it could be easy to add this functionality so that it could be
added in the respository, like this for example :

   <class-descriptor
          class="Customer"
          table="CUSTOMER"
          in-cache="false">
...
   </class-descriptor>


Like that you could customize which class need to always be up to date
compared to the database and which just need to be loaded one time (static
data).


thanks for your opinion on the subject

JB

 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to