Skip to content

Commit b2915dd

Browse files
committed
Allow 'null' to be cached.
This prevents repeated lookups in the database for stored procedures with no parameters.
1 parent 2c5ec00 commit b2915dd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/MySqlConnector/MySql.Data.MySqlClient/MySqlConnection.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ internal async Task<CachedProcedure> GetCachedProcedure(IOBehavior ioBehavior, s
311311
return null;
312312

313313
CachedProcedure cachedProcedure;
314+
bool foundProcedure;
314315
lock (cachedProcedures)
315-
cachedProcedures.TryGetValue(normalized.FullyQualified, out cachedProcedure);
316-
if (cachedProcedure == null)
316+
foundProcedure = cachedProcedures.TryGetValue(normalized.FullyQualified, out cachedProcedure);
317+
if (!foundProcedure)
317318
{
318319
cachedProcedure = await CachedProcedure.FillAsync(ioBehavior, this, normalized.Schema, normalized.Component, cancellationToken).ConfigureAwait(false);
319320
lock (cachedProcedures)

0 commit comments

Comments
 (0)