解决了语音上传到问题,接下来要解决下载播放问题
This commit is contained in:
65
Pods/Qiniu/QiniuSDK/Storage/ServerConfig/QNServerConfigCache.m
generated
Normal file
65
Pods/Qiniu/QiniuSDK/Storage/ServerConfig/QNServerConfigCache.m
generated
Normal file
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// QNServerConfigCache.m
|
||||
// QiniuSDK
|
||||
//
|
||||
// Created by yangsen on 2021/8/30.
|
||||
// Copyright © 2021 Qiniu. All rights reserved.
|
||||
//
|
||||
|
||||
#import "QNServerConfigCache.h"
|
||||
#import "QNUtils.h"
|
||||
#import "QNCache.h"
|
||||
|
||||
#define kQNServerConfigDiskKey @"config"
|
||||
#define kQNServerUserConfigDiskKey @"userConfig"
|
||||
|
||||
@interface QNServerConfigCache(){
|
||||
QNServerConfig *_config;
|
||||
QNServerUserConfig *_userConfig;
|
||||
}
|
||||
@property(nonatomic, strong) QNCache *configCache;
|
||||
@property(nonatomic, strong) QNCache *userConfigCache;
|
||||
@end
|
||||
@implementation QNServerConfigCache
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
QNCacheOption *option = [[QNCacheOption alloc] init];
|
||||
option.version = @"v1.0.0";
|
||||
self.configCache = [QNCache cache:[QNServerConfig class] option:option];
|
||||
|
||||
option = [[QNCacheOption alloc] init];
|
||||
option.version = @"v1.0.0";
|
||||
self.userConfigCache = [QNCache cache:[QNServerUserConfig class] option:option];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
//MARK: --- config
|
||||
- (QNServerConfig *)getConfigFromDisk {
|
||||
return [self.configCache cacheForKey:kQNServerConfigDiskKey];
|
||||
}
|
||||
|
||||
- (void)saveConfigToDisk:(QNServerConfig *)config {
|
||||
[self.configCache cache:config forKey:kQNServerConfigDiskKey atomically:true];
|
||||
}
|
||||
|
||||
//MARK: --- user config
|
||||
- (QNServerUserConfig *)getUserConfigFromDisk {
|
||||
return [self.userConfigCache cacheForKey:kQNServerUserConfigDiskKey];
|
||||
}
|
||||
|
||||
- (void)saveUserConfigToDisk:(QNServerUserConfig *)config {
|
||||
[self.userConfigCache cache:config forKey:kQNServerUserConfigDiskKey atomically:true];
|
||||
}
|
||||
|
||||
- (void)removeConfigCache {
|
||||
@synchronized (self) {
|
||||
[self.configCache clearMemoryCache];
|
||||
[self.configCache clearDiskCache];
|
||||
[self.userConfigCache clearMemoryCache];
|
||||
[self.userConfigCache clearDiskCache];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user