feat: sync httpdns sdk/platform updates without large binaries
This commit is contained in:
75
HttpDNSSDK/sdk/ios/NewHttpDNS/Persistent/HttpdnsDB.h
Normal file
75
HttpDNSSDK/sdk/ios/NewHttpDNS/Persistent/HttpdnsDB.h
Normal file
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// HttpdnsDB.h
|
||||
// TrustHttpDNS
|
||||
//
|
||||
// Created by xuyecan on 2025/3/15.
|
||||
// Copyright © 2025 trustapp.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "HttpdnsHostRecord.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* SQLite3数据库操作类,用于持久化存储HttpDNS缓存记录
|
||||
*/
|
||||
@interface HttpdnsDB : NSObject
|
||||
|
||||
/**
|
||||
* 初始化数据库
|
||||
* @param accountId 账户ID
|
||||
* @return 数据库实<E5BA93><E5AE9E>?
|
||||
*/
|
||||
- (instancetype)initWithAccountId:(NSInteger)accountId;
|
||||
|
||||
/**
|
||||
* 创建或更新记<E696B0><E8AEB0>?
|
||||
* @param record 主机记录
|
||||
* @return 是否成功
|
||||
*/
|
||||
- (BOOL)createOrUpdate:(HttpdnsHostRecord *)record;
|
||||
|
||||
/**
|
||||
* 根据缓存键查询记<E8AFA2><E8AEB0>?
|
||||
* @param cacheKey 缓存<E7BC93><E5AD98>?
|
||||
* @return 查询到的记录,如果不存在则返回nil
|
||||
*/
|
||||
- (nullable HttpdnsHostRecord *)selectByCacheKey:(NSString *)cacheKey;
|
||||
|
||||
/**
|
||||
* 根据缓存键删除记<E999A4><E8AEB0>?
|
||||
* @param cacheKey 缓存<E7BC93><E5AD98>?
|
||||
* @return 是否成功
|
||||
*/
|
||||
- (BOOL)deleteByCacheKey:(NSString *)cacheKey;
|
||||
|
||||
/**
|
||||
* 根据主机名数组批量删除记<E999A4><E8AEB0>?
|
||||
* @param hostNameArr 主机名数<E5908D><E695B0>?
|
||||
* @return 成功删除的记录数<E5BD95><E695B0>?
|
||||
*/
|
||||
- (NSInteger)deleteByHostNameArr:(NSArray<NSString *> *)hostNameArr;
|
||||
|
||||
/**
|
||||
* 获取所有缓存记<E5AD98><E8AEB0>?
|
||||
* @return 所有缓存记录数<E5BD95><E695B0>?
|
||||
*/
|
||||
- (NSArray<HttpdnsHostRecord *> *)getAllRecords;
|
||||
|
||||
/**
|
||||
* 清理指定时间点已过期的记<E79A84><E8AEB0>?
|
||||
* @param specifiedTime 指定的时间点(epoch时间<E697B6><E997B4>?
|
||||
* @return 清理的记录数<E5BD95><E695B0>?
|
||||
*/
|
||||
- (NSInteger)cleanRecordAlreadExpiredAt:(NSTimeInterval)specifiedTime;
|
||||
|
||||
/**
|
||||
* 删除所有记<E69C89><E8AEB0>?
|
||||
* @return 是否成功
|
||||
*/
|
||||
- (BOOL)deleteAll;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Reference in New Issue
Block a user