|
-
Dec 18th, 2003, 05:32 PM
#1
Thread Starter
Hyperactive Member
Cacheparameterset, getcachedparameterset methods
these two methods are in the class called "sqlhelperparametercache" class (part of data access app block).
The documentation says that the parameters sent to a stored procedure are cached . What does it mean by cached? are they stored in the RAM? because I don't find that happening.
when I first run a program (which invokes the 'cacheparameterset' method), say it stores the parameters in the RAM, according to my understanding when we run this program second time, it should be retrieving from the RAM. But I find the control calling this method again.
any ideas on this method?
thanks
nath
-
Jun 29th, 2007, 02:25 PM
#2
New Member
Re: Cacheparameterset, getcachedparameterset methods
For cached parameters, what it does is it sticks it in a hash table when you call CacheParameterSet, and then gets it from that hash table the next time around..
Here is a snippet from Microsoft ApplicationBlocks code
Code:
/// <summary>
/// add parameter array to the cache
/// </summary>
/// <param name="connectionString">a valid connection string for a SqlConnection</param>
/// <param name="commandText">the stored procedure name or T-SQL command</param>
/// <param name="commandParameters">an array of SqlParamters to be cached</param>
public static void CacheParameterSet(string connectionString, string commandText, params SqlParameter[] commandParameters)
{
string hashKey = connectionString + ":" + commandText;
paramCache[hashKey] = commandParameters;
}
Here is a link to the source code for SqlHelper if you want to look at the rest of it: http://www.sharpdeveloper.net/source...e-Code-cs.html
More details on SQLHelper
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|