htmgo/htmgo-site/pages/docs
franchb cfcfe7cb21
Use GetOrCompute for atomic cache access
The commit introduces an atomic GetOrCompute method to the cache interface and refactors all cache implementations to use it. This prevents race conditions and duplicate computations when multiple goroutines request the same uncached key simultaneously.

The changes eliminate a time-of-check to time-of-use race condition in the original caching implementation, where separate Get/Set operations could lead to duplicate renders under high concurrency.

With GetOrCompute, the entire check-compute-store operation happens atomically while holding the lock, ensuring only one goroutine computes a value for any given key.

The API change is backwards compatible as the framework handles the GetOrCompute logic internally. Existing applications will automatically benefit from the
2025-07-03 17:46:09 +03:00
..
config New Docs (#63) 2024-10-30 13:27:42 -05:00
control New Docs (#63) 2024-10-30 13:27:42 -05:00
core-concepts fix snippet 2024-11-30 10:57:42 -06:00
htmx-extensions gen code for assets (#68) 2024-11-01 06:10:35 -05:00
interactivity add docs for eval commands 2024-11-01 05:08:36 -05:00
misc minimal htmgo doc 2024-11-21 07:45:34 -06:00
performance Use GetOrCompute for atomic cache access 2025-07-03 17:46:09 +03:00
pushing-data Add custom cache stores docs and navigation 2025-06-27 16:25:05 +03:00
base.go css fixes 2024-10-30 14:44:02 -05:00
index.go New Docs (#63) 2024-10-30 13:27:42 -05:00
installation.go add windows instructions 2024-11-01 07:29:15 -05:00
introduction.go css fixes 2024-10-30 14:44:02 -05:00
related-projects.go minimal htmgo doc 2024-11-21 07:45:34 -06:00
sidebar.go Add custom cache stores docs and navigation 2025-06-27 16:25:05 +03:00