Forge cache module — pluggable cache (Redis/memory/PG). Wraps infrastructure-cache.
| Tier | application |
| Role | unclassified (baselined) |
| Path | crates/application/cache |
| Edition | 2024 |
| Targets | application_cache |
| Public items | 19 across 2 modules |
| Tests | 5 |
What it is for
application-cache — pluggable cache. Wraps infrastructure-cache.
B-009 Gate-0.5 finding: infrastructure-cache (crates/infrastructure/cache) ships no migrations/ directory and no CREATE TABLE anywhere in its source. Its Cargo.toml description advertises a Postgres backend, but the crate currently implements only MemoryCache (memory.rs) plus an optional redis feature flag with no bundled implementation file — there is no Postgres-backed variant shipping yet, so no schema exists to vendor. migrations() staying empty is correct for the crate as it stands today; revisit if/when a PgCacheBackend lands upstream.
Capabilities
CacheModule
application-cache — pluggable cache. Wraps infrastructure-cache.
| Item |
|---|
pub struct CacheModule |
CacheModule :: fn new() -> Self |
CacheModule :: fn name(& self) -> & 'static str |
CacheModule :: fn version(& self) -> & 'static str |
CacheModule :: fn migrations(& self) -> Vec <MigrationSet> |
CacheModule :: async fn migrate_pending(& self, _pool : & PgPool) -> std::result::Result <u32, MigrationError> |
services::static_cache (other)
Static-cache render pipeline.
| Item |
|---|
fn path_for_slug(base : & Path, slug : & str) -> PathBuf |
fn path_for_post(base : & Path, slug : & str) -> PathBuf |
fn path_for_blog_index(base : & Path) -> PathBuf |
fn path_for_feed(base : & Path) -> PathBuf |
fn path_for_sitemap(base : & Path) -> PathBuf |
async fn try_serve_static(base : & Path, slug : & str) -> Option <Response> |
async fn try_serve_post(base : & Path, slug : & str) -> Option <Response> |
async fn try_serve_feed(base : & Path) -> Option <Response> |
async fn try_serve_sitemap(base : & Path) -> Option <Response> |
RegenerateAllSummary
Static-cache render pipeline.
| Item |
|---|
pub struct RegenerateAllSummary |
RenderError
Static-cache render pipeline.
| Item |
|---|
pub enum RenderError |
async fn delete_static(base : & Path, slug : & str) -> Result <(), RenderError> |
fn atomic_write(path : & Path, bytes : & u8) -> Result <(), RenderError> |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
application_cache
servicesservices::static_cache
flowchart TD n_application_cache["application_cache"] n_application_cache --> n_services["services"] n_services --> n_services__static_cache["static_cache"]
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct CacheModule | — |
CacheModule :: fn new() -> Self | — |
CacheModule :: fn name(& self) -> & 'static str | — |
CacheModule :: fn version(& self) -> & 'static str | — |
CacheModule :: fn migrations(& self) -> Vec <MigrationSet> | — |
CacheModule :: async fn migrate_pending(& self, _pool : & PgPool) -> std::result::Result <u32, MigrationError> | — |
`services::static_cache`
| Item | What it is |
|---|---|
pub enum RenderError | — |
fn path_for_slug(base : & Path, slug : & str) -> PathBuf | home → index.html, anything else → <slug>.html |
fn path_for_post(base : & Path, slug : & str) -> PathBuf | /post/<slug> → <base>/post/<slug>.html. |
fn path_for_blog_index(base : & Path) -> PathBuf | /blog listing index path. |
fn path_for_feed(base : & Path) -> PathBuf | /blog/feed.xml cached path. |
fn path_for_sitemap(base : & Path) -> PathBuf | /sitemap.xml cached path. |
pub struct RegenerateAllSummary | Result of a regenerate_all run (T2c — populated when handlers are ported) |
async fn try_serve_static(base : & Path, slug : & str) -> Option <Response> | Try to serve cached HTML for slug |
async fn try_serve_post(base : & Path, slug : & str) -> Option <Response> | Try to serve <base>/post/<slug>.html. |
async fn try_serve_feed(base : & Path) -> Option <Response> | Try to serve the cached RSS feed at /blog/feed.xml. |
async fn try_serve_sitemap(base : & Path) -> Option <Response> | Try to serve the cached sitemap at /sitemap.xml. |
async fn delete_static(base : & Path, slug : & str) -> Result <(), RenderError> | Remove the static file for slug (idempotent — missing file is fine) |
fn atomic_write(path : & Path, bytes : & u8) -> Result <(), RenderError> | Atomic write: render to a .tmp file, fsync, rename |
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into infrastructure.
Shares tier application with 120 other crates: application-agreements, application-ai, application-analytics, application-approvals, application-assessments, application-audit-log, application-auth, application-billing, … (120 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | application |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/application/cache |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_application["application"] --> n_infrastructure["infrastructure"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `application-core` | application | no | always |
| `infrastructure-cache` | infrastructure | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
axum | ^0.7 | multipart | no | always |
chrono | ^0.4 | serde | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
thiserror | ^2 | — | no | always |
tokio | ^1 | full | no | always |
tracing | ^0.1 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development. None.
Build. None.
Depended on by. 1 workspace crate.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_cms["application-cms"] -->|uses| SELF SELF["application-cache"] SELF -->|runtime| n_application_core["application-core"] SELF -->|runtime| n_infrastructure_cache["infrastructure-cache"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | application_cache | `src/lib.rs` |
Error model
| Error type | Named by |
|---|---|
RenderError | atomic_write, delete_static |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | yes |
| database access | yes |
| network I/O | yes |
| unsafe code | none detected |
| environment variables | yes |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
| Variable | Read in |
|---|---|
CARGO_PKG_VERSION | src/lib.rs |
Related capabilities
1 workspace crate depends on this one: application-cms.
Verification
| Kind | Count |
|---|---|
| Unit tests | 5 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 1 | 0 | 0 |
services::static_cache | 13 | 0 | 2 |
What the tests establish, by name:
atomic_write_creates_new_file—src/services/static_cache.rsatomic_write_replaces_existing—src/services/static_cache.rspath_for_home_is_index_html—src/services/static_cache.rspath_for_post_under_post_subdir—src/services/static_cache.rspath_for_slug_is_slug_html—src/services/static_cache.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 12 | 19 |
Public modules with a //! block | 1 | 2 |
pie showData
title Public items with rustdoc
"Documented" : 12
"No rustdoc detected" : 7
Metrics
| Metric | Value |
|---|---|
| Rust source files | 3 |
| Source lines | 304 |
| Code lines | 214 |
| Public API items | 19 |
| Public modules | 2 |
| Tests | 5 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 12 |
| Workspace reverse dependencies | 1 |
pie showData
title Public API by kind
"enum" : 1
"function" : 11
"method" : 5
"struct" : 2
pie showData
title Rust source composition
"Code" : 214
"Blank or comment" : 90
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.