Create separate cache repository layer: - Add POfflineCacheRepository protocol for cache operations - Add OfflineCacheRepository with CoreData and Kingfisher - Add OfflineCacheSyncUseCase to coordinate sync workflow - Update PBookmarksRepository to focus on API calls only - Extend BookmarkEntityMapper with toDomain() conversion UseCase coordinates between cache, API, and settings repositories following dependency inversion principle.
25 lines
649 B
Swift
25 lines
649 B
Swift
//
|
|
// POfflineCacheRepository.swift
|
|
// readeck
|
|
//
|
|
// Created by Claude on 17.11.25.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
protocol POfflineCacheRepository {
|
|
// Cache operations
|
|
func cacheBookmarkWithMetadata(bookmark: Bookmark, html: String, saveImages: Bool) async throws
|
|
func hasCachedArticle(id: String) -> Bool
|
|
func getCachedArticle(id: String) -> String?
|
|
func getCachedBookmarks() async throws -> [Bookmark]
|
|
|
|
// Cache statistics
|
|
func getCachedArticlesCount() -> Int
|
|
func getCacheSize() -> String
|
|
|
|
// Cache management
|
|
func clearCache() async throws
|
|
func cleanupOldestCachedArticles(keepCount: Int) async throws
|
|
}
|