Article:
  Memoization in Java Using Dynamic Proxy Classes
Subject:   Caching decision at run time
Date:   2003-08-21 04:40:33
From:   anonymous2
If your Memoizer.memoize method returned a transitional object (basically a morphing singleton) you could use the statistics at runtime to make that decision.


The transitional object would collect statistics and also serve "getMemo()" the memo object to the client (what you currently return from Memoizer.memoize).


Once enough runs of the calculation have been done, this method could decide to return the real object or continue returning the memo version, minus statistics collection.


This would only make sense for long running processes that use the memo object more than once. But it would also safeguard against making performance decisions for one platform, and finding out it is wrong for another.


Yuri.

Full Threads Newest First

Showing messages 1 through 2 of 2.

  • Tom White photo Caching decision at run time
    2003-08-22 00:17:43  Tom White | O'Reilly Author [View]

    This is a nice idea. Getting the framework to make a performance descision at runtime would be very neat (analogous to the HotSpot compiler deciding which code to optimise). Do you have an idea of what the usage pattern would be? I.e. would there be an extra method call that the client would have to make?

    Tom
    • Caching decision at run time
      2009-06-26 11:12:51  rockslovejava [View]

      Hi,

      I am working on an application where there is a lots of interaction with the database. Now we are using caching but I am having adoubt how much data we can store in cache, i have set some limit in data storage, e.g like not more than 10 items would be cached at a same time. but the data is huge, could you please suggest or guide like whather should i go with that.

      i am targetting some data to be put in user session scope(not much).

      please suggest