maddalax
c4751467f5
rename to WithCacheStore
2025-07-03 13:56:36 -05:00
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
Eliah Rusin
04997d7315
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>
2025-06-26 21:38:38 +03:00
maddalax
0c84e42160
add info on how to change it
2025-01-06 10:26:15 -06:00
maddalax
4f537567ad
allow port to be configured
2025-01-06 10:24:49 -06:00
maddalax
ef83e34b1e
add RunAfterTimeout & RunOnInterval
2024-11-16 08:45:03 -06:00
maddalax
b234ead964
fix loading livereload extension
2024-11-09 12:32:30 -06:00
maddalax
34e816ff7c
Websocket Extension - Alpha ( #22 )
...
* wip
* merge
* working again
* refactor/make it a bit cleaner
* fix to only call cb for session id who initiated the event
* support broadcasting events to all clients
* refactor
* refactor into ws extension
* add go mod
* rename module
* fix naming
* refactor
* rename
* merge
* fix manager ws delete, add manager tests
* add metric page
* fixes, add k6 script
* fixes, add k6 script
* deploy docker image
* cleanup
* cleanup
* cleanup
2024-11-09 12:05:53 -06:00
maddalax
2c4ac8b286
gen code for assets ( #68 )
...
* gen code for assets
* fix
* test
2024-11-01 06:10:35 -05:00
maddalax
2d6ab078be
swap tests
2024-10-31 11:59:19 -05:00
maddalax
248e485ff0
ordered map tests, extensions test
2024-10-31 11:43:24 -05:00
maddalax
f42351e94f
more tests
2024-10-31 11:36:57 -05:00
maddalax
8a00828232
conditional tests
2024-10-31 11:11:09 -05:00
maddalax
f6556b579f
css form on blur validation
2024-10-31 09:44:16 -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
cb012a4d82
cleanup usage of orderedmap
...
add tests
add groupby
add groupbyordered
2024-10-29 05:48:13 -05:00
maddalax
7666186f83
add inline edit / fix copy button
2024-10-28 18:47:00 -05:00
maddalax
b65a913d4e
test more examples
2024-10-28 10:56:03 -05:00
maddalax
2726c60608
set charset on html content type
2024-10-26 21:41:21 -05:00
maddalax
2f35c08afd
comments about the service locator
2024-10-25 22:06:58 -05:00
maddalax
3468baaa84
Merge remote-tracking branch 'origin/master'
...
# Conflicts:
# framework/h/attribute.go
# framework/h/lifecycle.go
# framework/h/render.go
2024-10-25 22:01:04 -05:00
maddalax
cf76ca4f98
add some comments
2024-10-25 21:59:17 -05:00
maddalax
61758622ef
indent -> indentme
...
add details & summary html tag
2024-10-25 07:07:35 -05:00
maddalax
21ac153d5b
add transient to service loader, clear cache when setting a new value for the service
2024-10-23 11:10:48 -05:00
maddalax
a72de0a62f
add qs tests
2024-10-23 10:50:22 -05:00
maddalax
bb9fb0b327
write doctype when rendering html
2024-10-23 09:28:19 -05:00
Mohammad javad
30ac29fd6c
use path ( #32 )
...
* feat:add claasf
* refactor(tag.go)
* refactor(cache.go)
* refactor(attribute.go)
* refactor(app.go)
* refactor(attribute.go)
* fix:use path in PostPartialWithQs
* fix: PostPartial
2024-10-22 08:49:17 -05:00
Mohammad javad
a0f5b5dfd5
feat:add claasf ( #31 )
...
* feat:add claasf
* refactor(tag.go)
* refactor(cache.go)
* refactor(attribute.go)
* refactor(app.go)
* refactor(attribute.go)
2024-10-22 08:32:17 -05:00
maddalax
635b17dd7f
add support for ignoring specific files for automatic page/partial routing
2024-10-21 10:06:18 -05:00
Kevin Lewin
cea6b1cff2
Update slog output for server start ( #27 )
...
Fixing f string error.
2024-10-21 09:17:18 -05:00
maddalax
b6d901fadf
add some helper methods for redirect and setting cookie
2024-10-20 10:21:37 -05:00
maddalax
13f650b28b
simple auth example
2024-10-20 07:48:19 -05:00
Kevin Lewin
a7110576d2
Update app.go ( #24 )
...
Reformat server listening log message so user could click from terminal or ide
2024-10-18 17:29:59 -05:00
maddalax
2f0a526245
use non dev version of htmgo.js
2024-10-17 10:10:08 -05:00
github-actions[bot]
82382cf43f
Auto-update HTMGO framework version
2024-10-14 15:17:42 +00:00
maddalax
aff426829d
fix tests
2024-10-14 10:14:22 -05:00
maddalax
55337cde13
use diff dir
2024-10-14 10:06:00 -05:00
maddalax
c3be0e92d2
few tests
2024-10-14 10:05:14 -05:00
maddalax
d21afa5f6d
few tests
2024-10-14 10:02:04 -05:00
maddalax
3f502dba81
cleanup / add err handling
2024-10-14 09:58:37 -05:00
maddalax
2bac9307c6
more config
2024-10-14 09:49:48 -05:00
maddalax
da82b7f536
config wip
2024-10-13 16:33:08 -05:00
maddalax
8b9e536f14
add converter to site
2024-10-11 11:19:32 -05:00
maddalax
e750315764
release site after deps updated
2024-10-11 09:11:28 -05:00
maddalax
90b444a097
test
2024-10-11 09:07:56 -05:00
maddalax
ea5d4d5e2e
update onload to always be called when element gets rendered again
2024-10-11 08:56:56 -05:00
maddalax
819af8b7b8
infinite scroll
2024-10-10 20:17:31 -05:00
maddalax
4880946515
hn clone
2024-10-10 17:00:20 -05:00
maddalax
298f4dcd61
revert
2024-10-09 10:31:34 -05:00