> From: Per Kreipke [mailto:[EMAIL PROTECTED]] ... > Wouldn't it be nice if the second time you requested the image info, it was > as fast as the DirectoryGenerator? > > > Suggestions:
*DirectoryGenerators should be refactored so we have the only DirectoryGenerator with pluggable 'processors' of different file types. This way, you will be able to generate listings of different files of type in one directory. > - having getSize() call getFileType() and then getJpegSize() or > getGifSize(), introduces nice modularity but sacrifices speed. Each function > in that sequence calls (that's two calls total): > > new BufferedInputStream(new FileInputStream(file)); > > Instead, instantiate the BufferedInputStream in getSize() and pass it to the > other functions. Or move the work from getFileType() and get*Size() back in > to getSize(). Instantiate one instance of RandomAccessFile and pass it to 'processor'. > - more importantly, caching the information from getSize() plus > 'lastModified' in an internal hash table with the file's URL as key would > remove the need to do the expensive work each time. If the file hasn't > changed, then it's size (or MP3 info) hasn't either. Cache key should be directory name plus settings, such as depth and masks. Cache validity should be TimestampCacheValidity (FileTimeStampValidity in Cocoon 2.1) of all files selected by given depth/masks in this directory. > Unfortunately, I don't know Cocoon well enough to understand if Generators > are global instances (so that all requests will share the hash table) or > whether it exists per pipeline, per sitemap, etc. My point: I'm not sure how > to implement the cached info correctly. Implement generateKey and generateValidity methods. Vadim > I would love to do this work and send in the patch myself, and I'll attempt > to do so when I have the latest C2 source installed here. Unless someone > desparate does it first :-) > > Per --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]