forked from retoor/devplacepy
feat: add remote URL attachment support and project editing endpoint
This commit is contained in:
@@ -19,9 +19,9 @@ DevPlace runs safely under multiple Uvicorn workers. This page documents the mod
|
||||
The in-process caches (`_user_cache` in `utils.py`, `_settings_cache` in `database.py`) are fast but per-process. To keep them correct across workers, invalidation is coordinated through a `cache_state` table of named integer versions:
|
||||
|
||||
- A mutation that must invalidate a cache calls `bump_cache_version(name)` - an atomic `UPDATE ... version + 1` in the shared table.
|
||||
- Before serving from a cache, the worker calls `sync_local_cache(name, cache)`, which compares the table's version (read through a short 2s TTL) to the version its local cache was built against; if they differ, it clears the local cache and rebuilds from the database.
|
||||
- Before serving from a cache, the worker calls `sync_local_cache(name, cache)`, which reads the table's version directly and compares it to the version its local cache was built against; if they differ, it clears the local cache and rebuilds from the database. The version read is an uncached indexed primary-key lookup on the tiny `cache_state` table, so invalidation is immediate across workers and never lags behind a write.
|
||||
|
||||
The result: a logout, ban, role change, or settings save in one worker is honored by every worker within about two seconds, while the common path stays a cheap in-memory hit. `auth` covers `_user_cache` (logout, deactivation, role and password changes); `settings` covers `_settings_cache` (every `set_setting` and the admin settings save).
|
||||
The result: a logout, ban, role change, or settings save in one worker is honored by every other worker on its next request, while the common path stays a cheap in-memory hit on the data itself. `auth` covers `_user_cache` (logout, deactivation, role and password changes); `settings` covers `_settings_cache` (every `set_setting` and the admin settings save).
|
||||
|
||||
## Rate limiting
|
||||
|
||||
|
||||
Reference in New Issue
Block a user