Skip to content

Commit 76bd608

Browse files
Copilotxperiandri
andauthored
Use ValidationResultKey directly in cache instead of GetHashCode()
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/987870da-d259-4995-894e-9fce715836d7 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent 2de7990 commit 76bd608

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/FSharp.Data.GraphQL.Shared/ValidationResultCache.fs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ type IValidationResultCache =
1717
/// An in-memory cache for the results of schema/document validations, with a lifetime of 30 seconds.
1818
type MemoryValidationResultCache () =
1919
let expirationPolicy = CacheExpirationPolicy.SlidingExpiration(TimeSpan.FromSeconds 30.0)
20-
let internalCache = MemoryCache<int, ValidationResult<GQLProblemDetails>>(expirationPolicy)
20+
let internalCache = MemoryCache<ValidationResultKey, ValidationResult<GQLProblemDetails>>(expirationPolicy)
2121
interface IValidationResultCache with
2222
member _.GetOrAdd producer key =
23-
let internalKey = key.GetHashCode()
24-
internalCache.GetOrAddResult internalKey producer
23+
internalCache.GetOrAddResult key producer

0 commit comments

Comments
 (0)