Sync metadata cache
POST /api/v1/e/meta/syncHow sync works
Under normal operation, individual file metadata entries are cached in Valkey with a 1-hour TTL based on access patterns. This works well for most users, but when a user switches between apps frequently, the cache can become stale or fragmented. The sync endpoint performs a bulk synchronization. It takes all (or the most active) files for a user and pushes them into Valkey with a longer TTL in a single operation. This avoids the overhead of relying on individual cache hits.Sync types
| Type | Strategy | On limit exceeded |
|---|---|---|
allOne | Sync all files | Returns error, nothing is synced |
allTwo | Sync all files | Truncates - syncs as many files as fit within the limit |
mostOne | Sync most active files as a group | Returns error, nothing is synced |
mostTwo | Sync most active files as a group | Truncates - syncs as many files as fit within the limit |
Why
mostOne / mostTwo? Instead of making 15 separate cache hits for the 15 most active files, you make a single sync call to cache them all at once. This reduces endpoint hits and ensures the most accessed files are always warm in cache.Request body
The user ID whose files you want to sync.
The sync strategy. One of:
allOne, allTwo, mostOne, mostTwo.Example request
Example request
Response 200
Number of file metadata entries successfully synced to Valkey.
Number of entries skipped (e.g., due to the hard limit in
allTwo / mostTwo).Response 400
Returned when the sync would exceed the 450 MB hard limit (for allOne and mostOne types).
Response 404
Prefetch metadata
POST /api/v1/e/meta/prefetchRequest body
The user ID whose file metadata you want to prefetch.
Maximum number of files to prefetch. The service selects the most frequently queried files up to this limit.
Example request
Example request
Response 200
Number of file metadata entries pushed to cache.
Response 404
Invalidate metadata cache
POST /api/v1/e/meta/invalidateInvalidation types
| Type | Trigger | What it does |
|---|---|---|
OUT | User logs out | Removes metadata from Valkey only. The database is untouched. |
DEL | User deletes account | Removes metadata from both Valkey and the database (Convex). |
Request body
The user ID whose cached metadata you want to invalidate.
Invalidation type. One of:
OUT, DEL.Example request - logout
Example request - logout
Example request - account deletion
Example request - account deletion
Response 200
The invalidation type that was executed (
OUT or DEL).Number of metadata entries removed.

