Home / Function/ $withCache() — drizzle-orm Function Reference

$withCache() — drizzle-orm Function Reference

Architecture documentation for the $withCache() function in select.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  5ba5dc50_5b14_9ccb_9055_a65fc3074c05["$withCache()"]
  ca52fda7_20e9_67a9_3dbd_c1b59a433dbf["SQLiteSelectBase"]
  5ba5dc50_5b14_9ccb_9055_a65fc3074c05 -->|defined in| ca52fda7_20e9_67a9_3dbd_c1b59a433dbf
  style 5ba5dc50_5b14_9ccb_9055_a65fc3074c05 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/sqlite-core/query-builders/select.ts lines 932–939

	$withCache(config?: { config?: CacheConfig; tag?: string; autoInvalidate?: boolean } | false) {
		this.cacheConfig = config === undefined
			? { config: {}, enable: true, autoInvalidate: true }
			: config === false
			? { enable: false }
			: { enable: true, autoInvalidate: true, ...config };
		return this;
	}

Domain

Subdomains

Frequently Asked Questions

What does $withCache() do?
$withCache() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/query-builders/select.ts.
Where is $withCache() defined?
$withCache() is defined in drizzle-orm/src/sqlite-core/query-builders/select.ts at line 932.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free