Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultCache ¶
type DefaultCache struct {
// contains filtered or unexported fields
}
DefaultCache is the default cache implementation using sync.Map for thread-safe concurrent access.
func NewDefaultCache ¶
func NewDefaultCache() *DefaultCache
NewDefaultCache creates a new DefaultCache with an initialized sync.Map.
func (*DefaultCache) Load ¶
func (c *DefaultCache) Load(key [32]byte) (*SchemaCacheEntry, bool)
Load retrieves a schema from the cache.
func (*DefaultCache) Range ¶
func (c *DefaultCache) Range(f func(key [32]byte, value *SchemaCacheEntry) bool)
Range calls f for each entry in the cache (for testing/inspection).
func (*DefaultCache) Store ¶
func (c *DefaultCache) Store(key [32]byte, value *SchemaCacheEntry)
Store saves a schema to the cache.
type SchemaCache ¶
type SchemaCache interface {
Load(key [32]byte) (*SchemaCacheEntry, bool)
Store(key [32]byte, value *SchemaCacheEntry)
Range(f func(key [32]byte, value *SchemaCacheEntry) bool)
}
SchemaCache defines the interface for schema caching implementations. The key is a [32]byte hash of the schema (from schema.GoLow().Hash()).
type SchemaCacheEntry ¶
type SchemaCacheEntry struct {
Schema *base.Schema
RenderedInline []byte
ReferenceSchema string // String version of RenderedInline
RenderedJSON []byte
CompiledSchema *jsonschema.Schema
}
SchemaCacheEntry holds a compiled schema and its intermediate representations. This is stored in the cache to avoid re-rendering and re-compiling schemas on each request.
Click to show internal directories.
Click to hide internal directories.