mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Initial ad messages implementation
This commit is contained in:
@@ -71,6 +71,10 @@ final class ItemCacheTable: Table {
|
||||
self.valueBox.set(self.table, key: self.itemKey(id: id), value: encoder.readBufferNoCopy())
|
||||
})
|
||||
}
|
||||
|
||||
func putData(id: ItemCacheEntryId, entry: Data, metaTable: ItemCacheMetaTable) {
|
||||
self.valueBox.set(self.table, key: self.itemKey(id: id), value: ReadBuffer(data: entry))
|
||||
}
|
||||
|
||||
func retrieve(id: ItemCacheEntryId, metaTable: ItemCacheMetaTable) -> PostboxCoding? {
|
||||
if let value = self.valueBox.get(self.table, key: self.itemKey(id: id)), let entry = PostboxDecoder(buffer: value).decodeRootObject() {
|
||||
@@ -78,6 +82,13 @@ final class ItemCacheTable: Table {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func retrieveData(id: ItemCacheEntryId, metaTable: ItemCacheMetaTable) -> Data? {
|
||||
if let value = self.valueBox.get(self.table, key: self.itemKey(id: id)) {
|
||||
return value.makeData()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func remove(id: ItemCacheEntryId, metaTable: ItemCacheMetaTable) {
|
||||
self.valueBox.remove(self.table, key: self.itemKey(id: id), secure: false)
|
||||
|
||||
Reference in New Issue
Block a user