Module: Desiru::GraphQL::TypeCacheWarmer
- Extended by:
- TypeCacheWarmer
- Included in:
- TypeCacheWarmer
- Defined in:
- lib/desiru/graphql/type_cache_warmer.rb
Overview
Utility for warming the GraphQL type cache with common types
Instance Method Summary collapse
-
#cache_stats ⇒ Object
Get statistics about the type cache.
-
#warm_common_types! ⇒ Object
Pre-generate commonly used types to improve cold-start performance.
Instance Method Details
#cache_stats ⇒ Object
Get statistics about the type cache
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/desiru/graphql/type_cache_warmer.rb', line 16 def cache_stats cache = TypeBuilder.instance_variable_get(:@type_cache) mutex = TypeBuilder.instance_variable_get(:@cache_mutex) mutex.synchronize do { total_types: cache.size, output_types: cache.keys.count { |k| k.start_with?('Output:') }, enum_types: cache.keys.count { |k| k.include?('Enum') }, cache_keys: cache.keys } end end |
#warm_common_types! ⇒ Object
Pre-generate commonly used types to improve cold-start performance
10 11 12 13 |
# File 'lib/desiru/graphql/type_cache_warmer.rb', line 10 def warm_common_types! warm_common_output_types! warm_common_enums! end |