A community based topic aggregation platform built on atproto
at main 647 B view raw
1package unfurl 2 3import ( 4 "context" 5 "time" 6) 7 8// Repository defines the interface for unfurl cache persistence 9type Repository interface { 10 // Get retrieves a cached unfurl result for the given URL. 11 // Returns nil, nil if not found or expired (not an error condition). 12 // Returns error only on database failures. 13 Get(ctx context.Context, url string) (*UnfurlResult, error) 14 15 // Set stores an unfurl result in the cache with the specified TTL. 16 // If an entry already exists for the URL, it will be updated. 17 // The expires_at is calculated as NOW() + ttl. 18 Set(ctx context.Context, url string, result *UnfurlResult, ttl time.Duration) error 19}