/*
caching can be done with a singleton class with a setup similar to this
*/
public class Cache{
  // a static instance means it will always be there
  // and there will only be one of them
  private static Cache instance = null;

  // a container of objects - you may want to implement
  // something thats has a limit on the size and drops
  // out the least recently used object when something
  // is added
  HashMap objects = new Vector();

  // a private contructor is used with getInstance()
  private Cache(){}

  public static getInstance(){
    if(instance == null) instance = new Cache();
    return instance;
  }

  public void addObject(Object key, Object data){
    objects.add(key, data);
  }

  public void getObject(Object key){
    return objects.get(key);
  }
}


-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Thethi, Manmeet S
Sent: Wednesday, November 03, 1999 1:34 PM
To: [EMAIL PROTECTED]
Subject: Caching for Database objects


Does anyone know how can we introduce caching for database objects.
We are getting the data from database tables which is then converted to Java
objects.
We want to build some kind of caching mechanism so that we don't have to go
to database whenever a request for data (Java objects) comes in.

Any suggestions will be appreciated.

Thanks


Manmeet

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to