Hi,

I have a COM component to which sqlite++ library was added, now I want to 
improve caching of queries.

It's already working speeding up nicely by caching each query, but it uses a 
setting for how many queries to cache and for how long.

I believe in automating everything that's possible, so we are going to be 
making the below changes to add sort of self tuning to the 
cache.

This is used on my webserver to serve as backend for websites so read speed is 
important, writing to database isn't so much as I am 
standardizing on Ajax grid which writes to db in the background so user is not 
affected by slower writes.

the following is proposed caching setup:

query request is made that doesn't exist in cache:

1. new cache item with query result is created

2. a query is returned

query request is made that does exist in cache:

1. a cached query is returned

2. cached query gets it's hit value increased

when an update or delete is made to the database all queries that are possibly 
affected are requeried and cached again rather than 
being removed, once every 20 updates/deletes a clean up routine is invoked:

a. cached queries older than 60 minutes and with less than 1 for hit value are 
removed

b. all remaining cached queries get their hit value lowered by 1


I hope this is at least a little on subject, I am also hoping that someone 
might have an opinion on this as well as hopefully some 
suggestions or alternatives, the goal is to make this as much self 
tuning/maintaining as possible, any ideas that would expand on 
this or improve it are what I am hoping for =)

-ark 



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to