I haven't seen anyone ask this, but in my plan to migrate from OJB 0.9.9 to
1.01. I've run into a bit of a problem manipulating the cache, due to
changes in the caching between versions. 

In several cases we use database views as beans, and whenever we update the
table behind the view we would use our own extension of the class
ObjectCacheDefaultImpl via the following method:


public void removeClassFromCache(String className) {
       Enumeration enum = super.objectTable.keys();
       while (enum.hasMoreElements()) {
           String key = (String) enum.nextElement();
           if (key.startsWith(className)) {
               super.objectTable.remove(key);
           }

       }

    }

I built this with the intention that flushing a certain class would have
less of a sledgehammer effect than just flushing the whole cache each time.
As far as I know there is no way to tell OJB a view is related through
metadata so the cache would flush appropriate either (that would be nice!).

However with the new type of cache per broker implementation (which I would
like to use for a variety of reasons, mainly to connect to 2 different DBs
with the same exact schema and have no cache ramifications).

I converted my method to compile under the new cache interface, but I'm not
sure it will accomplish what I want:

    public void removeClassFromCache(String className) {
       Set enum = super.objectTable.keySet();
       Iterator it = enum.iterator();
       while (it.hasNext()) {
           String key = (String) it.next();
           if (key.indexOf(className)!=-1) {
               super.objectTable.remove(key);
           }

       }

    }

If I am using the cache per broker implementation, is there a way I can
access all of the individual cache classes to tell them to remove a certain
item or bean class? On that implementation if I tell it to flush the cache
does it tell all of the individual caches per broker to flush too?

As far as I can tell I'm just randomly getting a broker and wiping that
broker's cache, and nothing on a global scale.

Any advice appreciated,

Ryan


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

Reply via email to