how to cache the objects MANUALLY??

Discussions

General J2EE: how to cache the objects MANUALLY??

  1. how to cache the objects MANUALLY?? (4 messages)

    hello
     
    some o-r mapping tools can cache the objects that have been queried,then next time these objects are required,it don't need to access the database again,it can also monitor the database updating.
    i wonder how i can implement such "cache" function MANUALLY? because i DON'T want to use ANY o-r mapping tools. i only use the jdbc to query database,then generate the object.

    who can give me some clue?? or articles? or sample codes??

    thank you!!!!!
  2. how to cache the objects MANUALLY??[ Go to top ]

    Most ORM solutions use plugins to provide second-level cache functionality. That means that those cache solutions can be used directly.

    Try searching for Java cache libraries.

    Some popular ones are:

    JBoss Cache
    EHCache
    OSCache

    Hope that helps,
    Matan
  3. how to cache the objects MANUALLY??[ Go to top ]

    I use a simple solution. Every SELECT-string act as key for the resultung collection of business objects wich are stored in a hashmap.

    You have to take care that the map is not getting to big and have to remove less used objects from the map.

    On startup u can fill the cache with often used SELECTs like Fetch All and Fetch One.
  4. The SELECT is the key of the hashmap???? Horror!!!
  5. The SELECT is the key of the hashmap???? Horror!!!

    Please give me more details, what makes you so scared. Its a really simple, not much adjustable or scalable solution. But it works and speeded up an old application up to 100 times within one hour invested time.