class CachedFile
Caches uploaded media to avoid re-uploading the same Discord attachment to the Matrix homeserver.
Uses a composite primary key of (url, encrypted) because the same source URL may be uploaded both encrypted and unencrypted to different portal rooms.
cached = CachedFile.create( url: "https://cdn.discordapp.com/...", encrypted: false, mxc: "mxc://example.com/abc" )
Definitions
def self.by_url(url, encrypted: false)
Look up a cached file by source URL and encryption status.
Implementation
def self.by_url(url, encrypted: false)
first(url: url, encrypted: encrypted)
end