GeometryCache

GeometryCache

Thread-safe geometry cache for storing and retrieving computed geometric data. Improves performance by caching expensive geometric calculations.

Project: GridPlacement v6.0
Layer: Godot
Source: Godot/Core/_incomplete/Services/DI/GeometryCache.cs
Namespace: GridBuilding.Core.Services.DI
Kind: class

Parsing Method: AST-based (Roslyn) - NOT regex

⚠️ IMPORTANT: This documentation was generated using AST parsing, not regex.

Properties

Count

Gets the number of entries currently in the cache (including expired ones).

ActiveCount

Gets the number of non-expired entries in the cache.

Methods

GetOrCreate

Gets or creates a cached value using a factory function.

Returns: T

Parameters:

  • string key
  • Func<T> factory
  • TimeSpan? expiration

TryGet

Gets a value from the cache if it exists and is not expired.

Returns: bool

Parameters:

  • string key
  • T? value

Set

Stores a value in the cache with optional expiration.

Returns: void

Parameters:

  • string key
  • T value
  • TimeSpan? expiration

Remove

Removes a value from the cache.

Returns: bool

Parameters:

  • string key

Contains

Checks if a key exists in the cache and is not expired.

Returns: bool

Parameters:

  • string key

ClearExpired

Clears all expired entries from the cache.

Returns: int

Clear

Clears all entries from the cache.

Returns: void

GetStats

Gets cache statistics for monitoring.

Returns: CacheStats

Dispose

Returns: void

GetCachedDistance

Caches distance calculations between positions.

Returns: int

Parameters:

  • CoreVector2I from
  • CoreVector2I to
  • Func<CoreVector2I, CoreVector2I, int> calculator

GetCachedPositionsInRadius

Caches positions in radius calculations.

Returns: CoreVector2I[]

Parameters:

  • CoreVector2I center
  • int radius
  • Func<CoreVector2I, int, CoreVector2I[]> calculator

GetCachedRectangleOverlap

Caches rectangle overlap calculations.

Returns: bool

Parameters:

  • CoreVector2I pos1
  • CoreVector2I size1
  • CoreVector2I pos2
  • CoreVector2I size2
  • Func<CoreVector2I, CoreVector2I, CoreVector2I, CoreVector2I, bool> calculator