htmgo/framework
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
..
assets fix loading livereload extension 2024-11-09 12:32:30 -06:00
config gen code for assets (#68) 2024-11-01 06:10:35 -05:00
datastructure/orderedmap ordered map tests, extensions test 2024-10-31 11:43:24 -05:00
h Use GetOrCompute for atomic cache access 2025-07-03 17:46:09 +03:00
hx update onload to always be called when element gets rendered again 2024-10-11 08:56:56 -05:00
internal cleanup usage of orderedmap 2024-10-29 05:48:13 -05:00
js add RunAfterTimeout & RunOnInterval 2024-11-16 08:45:03 -06:00
service comments about the service locator 2024-10-25 22:06:58 -05:00
framework.go test 2024-09-24 15:59:24 -05:00
go.mod Auto-update HTMGO framework version 2024-10-14 15:17:42 +00:00
go.sum fix framework tests (sort attributes) 2024-09-26 16:01:41 -05:00
LICENSE framework license 2024-09-26 16:12:21 -05:00