docs: add Performance & Caching section to ConfigurationGuide
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -798,6 +798,39 @@ Administrators can set the **site-wide default** colour scheme that is applied w
|
|||||||
UI_DEFAULT_COLOR_SCHEME=dark
|
UI_DEFAULT_COLOR_SCHEME=dark
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Performance & Caching
|
||||||
|
|
||||||
|
DocuElevate automatically optimises database access and uses Redis as a
|
||||||
|
caching layer for frequently accessed data.
|
||||||
|
|
||||||
|
### Database Indexes
|
||||||
|
|
||||||
|
On startup the application creates indexes on columns used for filtering,
|
||||||
|
sorting, and joining in the file listing and status computation queries:
|
||||||
|
|
||||||
|
| Table | Column | Purpose |
|
||||||
|
|---|---|---|
|
||||||
|
| `files` | `created_at` | Default sort order |
|
||||||
|
| `files` | `mime_type` | MIME type filter & dropdown |
|
||||||
|
| `processing_logs` | `file_id` | Log retrieval by file |
|
||||||
|
| `processing_logs` | `timestamp` | Log ordering |
|
||||||
|
| `file_processing_steps` | `status` | Status filter sub-queries |
|
||||||
|
|
||||||
|
These indexes are created idempotently on every startup so no manual
|
||||||
|
migration step is required.
|
||||||
|
|
||||||
|
### Redis Query Cache
|
||||||
|
|
||||||
|
When Redis is available (configured via `REDIS_URL`), DocuElevate caches
|
||||||
|
selected query results to avoid redundant database round-trips:
|
||||||
|
|
||||||
|
| Cache Key | TTL | Description |
|
||||||
|
|---|---|---|
|
||||||
|
| `mime_types` | 120 s | Distinct MIME types shown in the file-list filter dropdown |
|
||||||
|
|
||||||
|
The cache is **fail-open**: if Redis is unreachable the application falls
|
||||||
|
back to querying the database directly with no user-visible impact.
|
||||||
|
|
||||||
## Configuration Examples
|
## Configuration Examples
|
||||||
|
|
||||||
### Minimal Configuration
|
### Minimal Configuration
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ Tests for database performance indexes and schema migrations.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from sqlalchemy import create_engine, inspect, text
|
from sqlalchemy import create_engine, inspect
|
||||||
from sqlalchemy.orm import sessionmaker
|
|
||||||
from sqlalchemy.pool import StaticPool
|
from sqlalchemy.pool import StaticPool
|
||||||
|
|
||||||
from app.database import Base, _ensure_indexes
|
from app.database import Base, _ensure_indexes
|
||||||
|
|||||||
Reference in New Issue
Block a user