refactor: generalize LruCache to support any key type (P5.16)
Made LruCache generic over key type K, not just UserId: - LruCache<V> → LruCache<K, V> - Added trait bounds: K: Eq + Hash + Clone + Copy - Updated UserCache field types: * user_usernames: LruCache<UserId, String> * user_names: LruCache<UserId, String> * user_statuses: LruCache<UserId, UserOnlineStatus> Benefits: - Reusable cache implementation for any key types - Type-safe caching - No additional dependencies Progress: Priority 5: 2/3 tasks, Total: 18/20 (90%) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
13
CONTEXT.md
13
CONTEXT.md
@@ -904,9 +904,9 @@ let message = MessageBuilder::new(MessageId::new(123))
|
||||
- ✅ Priority 2: 5/5 (100%)
|
||||
- ✅ Priority 3: 4/4 (100%) 🎉
|
||||
- ✅ Priority 4: 4/4 (100%) 🎉
|
||||
- ⏳ Priority 5: 1/3 (33%, P5.15 завершено)
|
||||
- ⏳ Priority 5: 2/3 (67%, P5.15, P5.16 завершены)
|
||||
|
||||
**Общий прогресс: 17/20 задач (85%)**
|
||||
**Общий прогресс: 18/20 задач (90%)**
|
||||
|
||||
**Последние изменения (1 февраля 2026)**:
|
||||
- ✅ **P5.15 — Feature flags для зависимостей** (2026-02-01)
|
||||
@@ -915,9 +915,14 @@ let message = MessageBuilder::new(MessageId::new(123))
|
||||
- Условная компиляция в коде с graceful degradation
|
||||
- Преимущества: уменьшение размера бинарника, модульность
|
||||
|
||||
- ✅ **P5.16 — LRU cache обобщение** (2026-02-01)
|
||||
- Обобщена структура `LruCache<K, V>` в src/tdlib/users.rs
|
||||
- Type-safe: `K: Eq + Hash + Clone + Copy`, `V: Clone`
|
||||
- Обновлены типы в UserCache: `LruCache<UserId, String>`, `LruCache<UserId, UserOnlineStatus>`
|
||||
- Переиспользуемая реализация без дополнительных зависимостей
|
||||
|
||||
**Следующие шаги**:
|
||||
- P5.16: LRU cache обобщение
|
||||
- P5.17: Tracing вместо println!
|
||||
- P5.17: Tracing вместо println! (последняя задача Priority 5!)
|
||||
|
||||
## Известные проблемы
|
||||
|
||||
|
||||
Reference in New Issue
Block a user