Commit graph

87 commits

Author SHA1 Message Date
maddalax
72c171709e wrap example in div 2025-08-16 09:47:51 -05:00
maddalax
5dba9d0167 param -> urlParam 2025-08-15 09:05:46 -05:00
Eliah Rusin
06f01b3d7c
Refactor caching system to use pluggable stores (#98)
* Refactor caching system to use pluggable stores

The commit modernizes the caching implementation by introducing a pluggable store interface that allows different cache backends. Key changes:

- Add Store interface for custom cache implementations
- Create default TTL-based store for backwards compatibility
- Add example LRU store for memory-bounded caching
- Support cache store configuration via options pattern
- Make cache cleanup logic implementation-specific
- Add comprehensive tests and documentation

The main goals were to:

1. Prevent unbounded memory growth through pluggable stores
2. Enable distributed caching support
3. Maintain backwards compatibility
4. Improve testability and maintainability

Signed-off-by: franchb <hello@franchb.com>

* Add custom cache stores docs and navigation

Signed-off-by: franchb <hello@franchb.com>

* 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

* rename to WithCacheStore

---------

Signed-off-by: franchb <hello@franchb.com>
Co-authored-by: maddalax <jm@madev.me>
2025-07-03 14:07:16 -05:00
maddalax
0d61b12561 fix snippet 2024-11-30 10:57:42 -06:00
maddalax
ab50eaecf4 mobile fixes css 2024-11-25 10:34:22 -06:00
maddalax
baf10419f7 fix examples link 2024-11-25 10:23:12 -06:00
maddalax
9b69b25d0b minimal htmgo doc 2024-11-21 07:45:34 -06:00
maddalax
7d04d8861f add windows instructions 2024-11-01 07:29:15 -05:00
maddalax
2c4ac8b286
gen code for assets (#68)
* gen code for assets

* fix

* test
2024-11-01 06:10:35 -05:00
maddalax
4c6187e18d add docs for eval commands 2024-11-01 05:08:36 -05:00
maddalax
e27cda5779 add discord route 2024-10-31 13:40:43 -05:00
maddalax
de0e06155b text input example 2024-10-31 10:16:03 -05:00
maddalax
833708e38a wrap lines on examples 2024-10-31 09:56:37 -05:00
maddalax
f6556b579f css form on blur validation 2024-10-31 09:44:16 -05:00
maddalax
3cd7577b06 css fixes 2024-10-30 14:44:02 -05:00
maddalax
e6223a36b7 remove myapp 2024-10-30 14:32:27 -05:00
maddalax
60a37b65d6 change version 2024-10-30 14:17:35 -05:00
maddalax
5feb271aed fix 2024-10-30 14:14:12 -05:00
maddalax
cb6fcdd676 new favicon 2024-10-30 14:07:38 -05:00
maddalax
129c230c72 fix link 2024-10-30 13:50:52 -05:00
maddalax
1ce5f37fc4 set title 2024-10-30 13:39:07 -05:00
maddalax
35877a1b2e
New Docs (#63)
* scripting enhancements

* tests

* cleanup / tests

* new docs wip

* add more docs

* more updates

* add caching docs

* add sse docs

* more docs

* sidebar, and fix navigation blocks

* remove old docs

* set proper meta

* fixes
2024-10-30 13:27:42 -05:00
maddalax
d85737bfb8
JS Eval Enhancements (#62)
* scripting enhancements

* tests

* cleanup / tests
2024-10-29 08:44:52 -05:00
maddalax
2ec9fd14c0 remove border for iframe examples 2024-10-29 05:54:34 -05:00
maddalax
cb012a4d82 cleanup usage of orderedmap
add tests
add groupby
add groupbyordered
2024-10-29 05:48:13 -05:00
maddalax
d44cd0b2ed fix urls 2024-10-29 05:11:35 -05:00
maddalax
2e110dcafd title case 2024-10-28 18:50:31 -05:00
maddalax
7666186f83 add inline edit / fix copy button 2024-10-28 18:47:00 -05:00
maddalax
62a141ff6c blur overlay on iframe 2024-10-28 11:49:21 -05:00
maddalax
930b3dd1d3 replace examples page with v2 2024-10-28 11:39:46 -05:00
maddalax
1ca8bbf6e0 render the code from github since we wont have it locally 2024-10-28 11:27:25 -05:00
maddalax
b65a913d4e test more examples 2024-10-28 10:56:03 -05:00
maddalax
42febeb654 snippets view testing / cleanup 2024-10-28 10:32:50 -05:00
maddalax
4693820820 more css fixes 2024-10-26 16:55:15 -05:00
maddalax
62599c22ea some more fixes 2024-10-26 15:26:23 -05:00
maddalax
5ee5d956f0 fix max width 2024-10-26 15:15:31 -05:00
maddalax
8feb717d91 quick mobile fix 2024-10-26 14:56:51 -05:00
maddalax
4398eb1fdb style fixes 2024-10-25 14:11:48 -05:00
maddalax
8736c00fd5
htmgo - custom formatter (#47)
* format htmgo elements on save

* formatter updates

* ensure we maintain comments
2024-10-25 10:33:48 -05:00
maddalax
07b0c2d3c5 fix css on html to go 2024-10-23 10:34:59 -05:00
maddalax
c32fa1bccd add user auth to examples page 2024-10-20 08:09:40 -05:00
maddalax
a466726b70 send insights 2024-10-15 10:51:32 -05:00
maddalax
0ada050eff add docsearch 2024-10-15 10:26:30 -05:00
maddalax
2bac9307c6 more config 2024-10-14 09:49:48 -05:00
maddalax
f39c4d2c58 fix doc page css 2024-10-13 08:24:23 -05:00
maddalax
8b9e536f14 add converter to site 2024-10-11 11:19:32 -05:00
maddalax
78f7a68c1e add hn clone to examples 2024-10-10 17:31:07 -05:00
maddalax
c0fabcedd2 no sticky sidebar for now because of small screens 2024-10-10 10:13:57 -05:00
maddalax
b8dbcd4262 add favicon / public folder to template and htmgo-site 2024-10-10 09:24:50 -05:00
maddalax
1c3065e432 add info about the extensions 2024-10-10 09:07:03 -05:00