Module cache

Module cache 

Source
Expand description

Schema caching for improved performance.

This module provides:

  • Schema caching to avoid re-parsing
  • String interning for documentation strings
  • Lazy computed fields

§Examples

use prax_schema::cache::{SchemaCache, DocString};

// Cache parsed schemas
let mut cache = SchemaCache::new();

let schema = cache.get_or_parse("model User { id Int @id }").unwrap();
let schema2 = cache.get_or_parse("model User { id Int @id }").unwrap();
// schema2 is the same Arc as schema (cached)

// Intern documentation strings
let doc1 = DocString::intern("User profile information");
let doc2 = DocString::intern("User profile information");
// doc1 and doc2 share the same allocation

Structs§

CacheStats
Statistics for the schema cache.
DocString
An interned documentation string.
FieldAttrsCache
Cached field attribute values.
LazyFieldAttrs
Lazily computed field attributes.
SchemaCache
A cache for parsed schemas.
ValidationTypePool
Pool of commonly used validation types.
ValidatorDef
A cached validator definition.

Enums§

ValidatorType
Type of validator.

Statics§

VALIDATION_POOL
Global validation type pool.