Results 1 to 2 of 2

Thread: Cacheparameterset, getcachedparameterset methods

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    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

  2. #2
    New Member
    Join Date
    Jun 2007
    Location
    Canada
    Posts
    1

    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
  •  



Click Here to Expand Forum to Full Width