To Cache or not

C

Chris

Hi All,

I've recently been making use of data caching by storing small,
frequently accessed, infrequently updated tables in the cache.
I've been using a static class to maintain access to cached data:

public static Meeting getMeeting(string _idMeeting)
{
if (checkMeetingCached(_idMeeting))
{
return getMeetingFromCache(_idMeeting);
}
else
{
lock (Meetings)
{//to make sure 2 users are not adding the same data
to the cache, we'll do one more check
//on the cache.
if (checkMeetingCached(_idMeeting))
{
return getMeetingFromCache(_idMeeting);
}
else
{
return addMeetingToCache(_idMeeting);
}
}
}
}

What this does is simply check if the meeting is in the cache, if not,
it adds it and accesses it from the cache with future requests.
Is my use of static class appropriate? Or would this be causing any
form of performance issue? Meetings are stored in a DataTable called
"Meetings".
If the cache["tablename"] is null, the meeting table is created and
inserted into that cache var. If not null, it is assigned to a
datatable object for the duration of the request.

I have been given a project which utilises a MySQL db. The main table
it references has 8000 records. These records are searchable. The site
has a bespoke paging mechanism for search results. So each query will
first hit the db to find a COUNT() matched records, then another DB
hit to return a set number of records, and a final db hit to retrieve
the selected information.
Would I see any performance increase by caching the entire table of
8000 records? It would remove all DB hits apart from the one which
inserts the table to cache, but i'm unsure if this would outweigh
other performance penalties.

Any help and advice is appreciated,


Chris
 
G

Guest

has a bespoke paging mechanism for search results. So each query will
first hit the db to find a COUNT() matched records, then another DB
hit to return a set number of records, and a final db hit to retrieve
the selected information.

Chris,

Did you try to use stored procedures in MySql? You can try to reduce
the number of hits by doing all requests from a stored procedure...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top