DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30243>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30243

Content Caching?

           Summary: Content Caching?
           Product: Slide
           Version: 2.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Stores
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The content cache doesn't appear to be caching successfully. Every time I 
access content Extended Store attempt to recache the content.  I noticed a 
long time ago on the dev list that someone mentioned that this wasn't working 
correcly(msg #06671).  Was this ever fixed? If it hasn't, here is my fix to 
the put method of ByteSizeLimitedObjectCache which fixes the problem for me.


        public Object put(Object key, Object value, long byteSize) {
            // is it too big to be cached?
            if (byteSize > maxByteSizePerEntry || byteSize > maxByteSize) {
                if (loggingEnabled) {
                    logger.log(txId + " for '" + key + "' is too big to be 
cached", logChannel, Logger.DEBUG);
                }
                Object oldValue = get(key);
                // invalidate previous entry if present
                // XXX this relies on an implementation detail in 
TxLRUByteCache.put
                // removal from delete cache must be done before trying to add 
to
                // change cache using this method; if not our undoing will be 
partly
                // undone (again) in TxLRUObjectCache.put
                invalidate(key);
                return oldValue;
            } else {
                // be sure to return allocated bytes before readding
                //freeBytes(key);

                // ok, we decided to cache this entry, make room for it
                for (int i = 0; globalSize + byteSize > maxByteSize && i < 
MAX_FREEING_TRIES; i++) {
                    if (loggingEnabled) {
                        logger.log(
                            txId
                                + " for '"
                                + key
                                + "' needs "
                                + Long.toString(globalSize + byteSize - 
maxByteSize)
                                + " bytes more to be cached. Freeing bytes!",
                            logChannel,
                            Logger.DEBUG);
                    }
                        // this will call back processRemovedLRU and will thus 
free bytes
                        removeLRU();
                                }
            }
            // was this successful?
            if (globalSize + byteSize <= maxByteSize) {
                shadowSizes.put(key, new Long(byteSize));
                globalSize += byteSize;
                return super.put(key, value);
            } else {
                Object oldValue = get(key);
                invalidate(key);
                return oldValue;
            }
        }

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

Reply via email to