# Funkycache caches Python functions in SQLite with automatic invalidation

Original title: Funkycache: A Python library to cache functions in SQLite

> Hacker News story 50522991 · language: en · submitted 2026-11-16
> Web version: https://zeli.app/story/50522991
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 14 · by [wmchen](<https://news.ycombinator.com/user?id=wmchen>) · 💬 7
[original](<https://alexwlchan.net/2026/funkycache/>) · [HN discussion](<https://news.ycombinator.com/item?id=50522991>)

## Summary

Alex Chan built funkycache, a Python library that caches function results in SQLite using a decorator modeled on functools.cache. It stores arbitrary Python objects as inputs and outputs, hashes arguments with XXH64 for compact keys, and invalidates caches when source files, dependent files, or specified values change. The library materializes lazy generators and enforces a memory budget. Chan's static site now builds with a warm cache in about half a second.

## Key quote

> I was so unsure of this code that I deleted the cache whenever I built the site for publication.

## HN discussion (7 comments)

### [Twirrim](<https://news.ycombinator.com/item?id=50566293>)

> One of the more mature libraries in this space would be diskcache https://pypi.org/project/diskcache/  https://grantjenks.com/docs/diskcache/
>
> Very easy to use, and performant. Uses an sqlite backend.  I'll often drop it in to a project temporarily if I'm in a position of feeling my way through a problem just to cut down execution time for things that aren't relevant to what I'm working on.

### [wulfmann](<https://news.ycombinator.com/item?id=50560720>)

> Forbidden

### [hmartin](<https://news.ycombinator.com/item?id=50561960>)

> https://pypi.org/project/funkycache/

---

## Cite

- Page: https://zeli.app/story/50522991
- Date: 2026-11-16
- Source: alexwlchan.net (https://alexwlchan.net/2026/funkycache/)
- Hacker News: https://news.ycombinator.com/item?id=50522991

## Other languages

- zh: https://zeli.app/zh/story/50522991 · markdown: https://zeli.app/zh/story/50522991.md
- ja: https://zeli.app/ja/story/50522991 · markdown: https://zeli.app/ja/story/50522991.md
- ko: https://zeli.app/ko/story/50522991 · markdown: https://zeli.app/ko/story/50522991.md
- de: https://zeli.app/de/story/50522991 · markdown: https://zeli.app/de/story/50522991.md
- es: https://zeli.app/es/story/50522991 · markdown: https://zeli.app/es/story/50522991.md
- ru: https://zeli.app/ru/story/50522991 · markdown: https://zeli.app/ru/story/50522991.md
