Pigeon icon indicating copy to clipboard operation
Pigeon copied to clipboard

Find the best way to integrate CoreData or Realm as a cache

Open fmo91 opened this issue 3 years ago • 0 comments

Right now, the only persistent cache that Pigeon provides is UserDefaultsQueryCache, which is very convenient but it's not CoreData.

On the other hand, Pigeon provides QueryCacheType as a way to extend cache functionality. By implementing these properties, users can extend Pigeon cache functionality

public protocol QueryCacheType {
    func save<T: Codable>(_ value: T, for key: QueryKey, andTimestamp timestamp: Date)
    func invalidate(for key: QueryKey)
    func isValueValid(
        forKey key: QueryKey,
        timestamp: Date,
        andInvalidationPolicy invalidationPolicy: QueryCacheConfig.InvalidationPolicy
    ) -> Bool
    func get<T: Codable>(for key: QueryKey) -> T?
}

How can we improve CoreData integration in Pigeon? Any ideas?

fmo91 avatar Aug 30 '20 19:08 fmo91