Caching queries to DB for dial plan records

It seems for me that it’s quite possible to implemet some sort of caching while querying to database for dial plan, when it’s stored in database.

We’re using asterisk 1.4.21.1 and Oracle as storage for data asterisk uses (and writes).
And, recently, we noticed asterisk been acting slower that some time before, which is noticeable even when asterisk processes 10 threads (as sum of outcoming and incoming calls) simultaneously. Our supposition on this case based on the weakness of server machine, so we started to think of performance improving. And, through any others minor fixes, we found that asterisk may do thousands queries per minute to DB to get next dial plan step: “SELECT * FROM extension_conf WHERE context = :1 AND extension = :2 AND priority = :3”

So, I’m sure it’s not a new idea to introduce some caching mode to reduce number of queries to DB, for example to get all step with same (context, extension). Problem may be to how effectively share, monitor, refresh and debug this cache, but it’s not impossible too.

I tried to search through web to find something interesting in such case, but failed. Maybe you can give some sources of ideas in this direction.
And, anyway, it seems that we’ll try to implement caching on our own if won’t find anything interesting.

Thanks for attention.