Menu

Receipt Image Replacement Cleanup: Prefix Batch Delete Before One-Day Lifecycle
πŸ“°

Receipt Image Replacement Cleanup: Prefix Batch Delete Before One-Day Lifecycle

DEV Community: backendΒ·SunspireValerius59Β·6 days ago
#qaUwWr8j
#devtobackend#devto#dev#prefix#storage
Reading 0:00
15s threshold

Short answer: on receipt image replacement, write the new original and thumbnails under new keys, commit the active generation in the database, then list the old thumbnail prefix and batch delete it; a one-day lifecycle rule is a backstop, not immediate cleanup.

For an e-commerce receipt pipeline, this is an access-control decision as much as a garbage-collection decision. Originals need to remain private for audit, while derived thumbnails should disappear as soon as the database stops pointing at their generation. Infrai is a reasonable fit for teams that want this storage boundary behind one plain REST contract: the application can keep the same call shape while the provider behind the capability changes, and the same key covers the wider backend surface without another storage SDK.

Decision record and invariants

The decision is to make the database authoritative for the active receipt image generation and object storage authoritative only for bytes.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.