You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2484ced
Browse filesBrowse the repository at this point in the historyBrowse files
@@ -585,20 +585,40 @@ Medium–High in widgets-heavy setups. Calendar widgets are often present on eve
585
585
- APCu: `fp:storage:quota:vN` with default TTL 3600s (payload includes `ts`).
586
586
- File fallback: `fp-content/cache/storage.quota.json` with TTL = `$ttl` (based on file mtime).
587
587
- FlatPress folder total size:
588
-
- APCu: `fp:storage:dirsize:v1:<sha1(root)>` with TTL 120s.
588
+
- APCu: `fp:storage:dirsize:root:<sha1(root)>:vN` with TTL 120s.
589
589
- File fallback: `fp-content/cache/storage.dirsize.json` with TTL 120s.
590
590
591
+
**Cold rebuild path:**
592
+
593
+
- The Storage panel resolves the aggregate cache and FlatPress-root-size cache before traversing the filesystem.
594
+
- If both caches are cold and `CONTENT_DIR` is below `BASE_DIR`, one `RecursiveDirectoryIterator` traversal of the FlatPress root computes both result sets.
595
+
- If only the aggregate is cold, only `CONTENT_DIR` is streamed.
596
+
- If only the root-size cache is cold, only the root-size metric is collected.
597
+
- Entry and comment files are counted and sized directly from `SplFileInfo`; the Storage scanner does **not** call `bdb_parse_entry()` and does not materialize a complete `fs_pathlister` array.
598
+
- Symbolic links are not followed. `RecursiveIteratorIterator::CATCH_GET_CHILD` and per-file exception handling preserve best-effort behavior on restrictive/shared-host filesystems.
599
+
591
600
**Invalidation:**
592
601
593
-
- Namespaced via `plugin_storage_cache_ns()` reading `fp:storage:v`.
594
-
- Version bump via `plugin_storage_cache_bump()` (`apcu_incr('fp:storage:v', …)`) is triggered by:
Other file fallbacks rely on their TTL and are refreshed on demand.
602
+
- APCu data is namespaced through `plugin_storage_cache_ns()` and `fp:storage:v`.
603
+
- The namespace value is memoized for the current request so an in-progress scan remains tied to the generation it started with. After a successful bump, the mutation request refreshes its own memoized namespace immediately.
604
+
-`plugin_storage_cache_bump()` is bound only to post-success hooks:
605
+
-`entry_saved`
606
+
-`entry_deleted`
607
+
-`comment_saved`
608
+
-`comment_deleted`
609
+
- The file fallbacks `storage.aggregate.json` and `storage.dirsize.json` are purged on every bump **even when APCu is unavailable**.
610
+
- When APCu is available, the same bump increments `fp:storage:v`, invalidating aggregate, root-size, channel-size and quota APCu keys by generation.
611
+
- Channel JSON fallbacks (`storage.dirsize.*.json`) and `storage.quota.json` are not purged by content mutations; they retain their own TTL-based refresh because entry/comment writes do not change image/attachment content or hosting quota limits directly.
612
+
613
+
**Write safety:**
614
+
615
+
- Before an APCu-backed cold scan is persisted, the Storage plugin rechecks the generation it started with. If a concurrent successful mutation bumped `fp:storage:v`, that scan result is used only for the current response and is **not** written into the newer APCu generation or its JSON fallback.
616
+
- Aggregate and root-size JSON fallbacks are written through `io_write_file()`, i.e. temp-file + rename atomic replacement.
617
+
- Cache write or cache purge failures are best effort and never participate in the success/failure decision of entry or comment writes.
618
+
- APCu remains optional. With APCu disabled, the same Storage metrics and invalidation semantics continue to work through the JSON fallbacks; cross-request generation detection is not available without a shared in-memory backend, so the short file TTL remains the final stale-data bound for external/concurrent changes that bypass normal hooks.
599
619
600
620
**Impact:**
601
-
Low–Medium. Mostly relevant for admin and diagnostics; not on every frontend request.
621
+
Medium–High for large installations in the Storage admin panel. The warm path stays cache-backed, while a complete aggregate/root cache miss avoids per-entry parsing, full path-list materialization and a second full FlatPress-tree traversal.
602
622
603
623
---
604
624
@@ -1020,10 +1040,13 @@ Some features use a **dual-layer cache** (APCu + file fallback) to stay fast eve
1020
1040
- Invalidation: version bump (`fp:calendar:v`) plus file purge (`calendar-*.html`) on `plugin_calendar_cache_bump()`.
| Media Manager usage index |`mediamanager:usage-index:v1`| No |`entry_saved`/`entry_deleted`, dirty recovery | High (large sites) |
1110
1133
| Mastodon scheduler summary | core `fp:io:*` for `scheduler-state.json`| No | File mtime/size via core I/O, rebuilt from `state.json` when stale | Medium |
@@ -1163,7 +1186,7 @@ For completeness, the following logical prefixes are used by FlatPress `1.6.dev`
0 commit comments