htmgo/htmgo-site/pages
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
..
base gen code for assets (#68) 2024-11-01 06:10:35 -05:00
docs Use GetOrCompute for atomic cache access 2025-07-03 17:46:09 +03:00
examples mobile fixes css 2024-11-25 10:34:22 -06:00
discord.go add discord route 2024-10-31 13:40:43 -05:00
html-to-go.go New Docs (#63) 2024-10-30 13:27:42 -05:00
index.go New Docs (#63) 2024-10-30 13:27:42 -05:00
markdown.go more css fixes 2024-10-26 16:55:15 -05:00
test.go New Docs (#63) 2024-10-30 13:27:42 -05:00
time.go New Docs (#63) 2024-10-30 13:27:42 -05:00