Show HN: A pragmatic SQLite schema for application-level caching
gist.github.com·16h·
Discuss: Hacker News
Flag this post

SQLite Caching Schema

This schema provides a ready-to-use structure for caching different data types.

Types

Immutable

It efficiently stores and retrieves immutable binary and textual data, accessed by a textual key. Use the cache_blob and cache_text tables for this purpose.

Versioned:

For slowly changing data, use the cache_rev table. It is an append-only table that preserves every revision but is optimized to look up only the most recent one for a given key.

Versioned and paged:

HTTP APIs often returned chunked data in pages. When this data must be preserved exactly as-is—where pre-processing is undesirable or even forbidden—the cache needs to maintain its paged nature.

The cache_rev_paged table is designed for this. Like the cache_rev table,…

Similar Posts

Loading similar posts...