Dear REALdatabase gurus out there,

After loading an initial batch of thumbnails from hundreds (maybe thousands)
of images, I need to store them in a cache, so that the small thumbnails get
loaded quickly the next time the images list is displayed (instead of having
to fetch/re-create a thumbnail for every large image file again).

Before anyone suggests saving the thumbnail into the image itself as a
preview, that's a Mac-only solution and this needs to be a cross-platform
Mac & Windows solution.

So in determining the best method to cache the thumbnails, I was thinking
that I could do either of the two methods:

(A) -- Use a REALdatabase file to store the folderitem's GetSaveInfo as one
field and the folderitem's 4kb Thumbnail pic in another field (blob).  When
needing to load a specific thumbnail in the list, the DB is searched for the
folderitem and when a match is found, pull the related thumbnail picture
from the DB.

- OR -

(B) -- Save the thumbnail as a small 4k image in a cache folder on disk, and
then use a REALdatabase file to store the folderitem's GetSaveInfo as one
field and the Thumbnail's folderitem GetSaveInfo as another field.  When
needing to load a specific thumbnail in the list, the DB is searched for the
folderitem and when a match is found, use the related thumbnail folderitem
data to go fetch the Thumbnail on disk and OpenAsPicture.


The advantage of method -A- is that it nicely contains the entire cache in
one single DB file instead of a messy folder of thousands of small thumbnail
images, but I worry that pulling a 4kb Picture out of a REALdatabase blob
field could be slower than simply fetching a small 4kb
folderitem.OpenAsPicture.

I know that Dictionaries are very fast, but if someone has an image
collection of literally thousands of images, then loading an entire cache of
thousands of thumbnails into a Dictionary into memory could require some
seriously hefty RAM allocation.  For example: 4kb x 10,000 images = 40 MB of
RAM.

So with all of this mind, any thoughts of wisdom from experienced
REALdatabase users on the two methods described above?  Or are there some
caching methods/options out there that I haven't thought of that are faster,
more efficient?  Speed is the crucial element here.

I'm using RB2006r1 on Mac OS X 10.4.5

Sorry for the long-winded post.  Thanks in advance for any insight that
anyone wishes to send my way.  :-)

Regards,
Dave Wooldridge
Electric Butterfly
http://www.ebutterfly.com

----------------------------------------
RB Garage - http://www.RBGarage.com
The largest independent online resource
For REALbasic software developers!
----------------------------------------




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to