mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Poll improvements
This commit is contained in:
@@ -37,6 +37,17 @@ final class ItemCacheTable: Table {
|
||||
return key
|
||||
}
|
||||
|
||||
private func lowerBound(collectionId: ItemCacheCollectionId) -> ValueBoxKey {
|
||||
let key = ValueBoxKey(length: 1 + 1)
|
||||
key.setInt8(0, value: ItemCacheSection.items.rawValue)
|
||||
key.setInt8(1, value: collectionId)
|
||||
return key
|
||||
}
|
||||
|
||||
private func upperBound(collectionId: ItemCacheCollectionId) -> ValueBoxKey {
|
||||
return self.lowerBound(collectionId: collectionId).successor
|
||||
}
|
||||
|
||||
private func itemIdToAccessIndexKey(id: ItemCacheEntryId) -> ValueBoxKey {
|
||||
let key = ValueBoxKey(length: 1 + 1 + id.key.length)
|
||||
key.setInt8(0, value: ItemCacheSection.accessIndexToItemId.rawValue)
|
||||
@@ -72,6 +83,10 @@ final class ItemCacheTable: Table {
|
||||
self.valueBox.remove(self.table, key: self.itemKey(id: id), secure: false)
|
||||
}
|
||||
|
||||
func removeAll(collectionId: ItemCacheCollectionId) {
|
||||
self.valueBox.removeRange(self.table, start: self.lowerBound(collectionId: collectionId), end: self.upperBound(collectionId: collectionId))
|
||||
}
|
||||
|
||||
override func clearMemoryCache() {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user