cache

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaTTL = 1 * time.Hour

SchemaTTL is how long a cached schema remains valid.

Variables

This section is empty.

Functions

func ShouldInvalidate

func ShouldInvalidate(err error) bool

ShouldInvalidate checks if an error indicates the schema has changed. Returns true for validation_error codes with schema-mismatch messages.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache provides schema caching backed by SQLite.

func Open

func Open() (*Cache, error)

Open opens or creates the cache database at ~/.cache/notion/schema.db.

func (*Cache) Close

func (c *Cache) Close() error

Close closes the cache database.

func (*Cache) GetSchema

func (c *Cache) GetSchema(databaseID string) (*types.Database, error)

GetSchema retrieves a cached database schema. Returns nil if not found or expired.

func (*Cache) InvalidateAll

func (c *Cache) InvalidateAll() error

InvalidateAll clears all cached schemas.

func (*Cache) InvalidateSchema

func (c *Cache) InvalidateSchema(databaseID string) error

InvalidateSchema removes a cached schema by database ID.

func (*Cache) IsExpired

func (c *Cache) IsExpired(databaseID string) bool

IsExpired checks if a cached entry has expired.

func (*Cache) SetSchema

func (c *Cache) SetSchema(databaseID string, db *types.Database) error

SetSchema stores a database schema in the cache.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL