Files
yinmeng-ios/xplan-ios/Main/Message/View/Session/SessionRiskCache.m
2022-08-11 16:43:37 +08:00

51 lines
846 B
Objective-C

//
// SessionRiskCache.m
// xplan-ios
//
// Created by 冯硕 on 2022/8/11.
//
#import "SessionRiskCache.h"
#import "AccountInfoStorage.h"
static SessionRiskCache * cache = nil;
@interface SessionRiskCache ()
///
@property (nonatomic,strong) NSCache *cache;
@end
@implementation SessionRiskCache
+ (instancetype)shareCache {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
cache = [[SessionRiskCache alloc] init];
});
return cache;
}
- (void)saveCloseRisk:(NSString *)userId {
if (userId.length > 0) {
[self.cache setObject:userId forKey:userId];
}
}
- (NSString *)getCloseChatRiskAlert:(NSString *)userid {
if (userid) {
return [self.cache objectForKey:userid];
}
return nil;
}
- (NSCache *)cache {
if (!_cache) {
_cache = [[NSCache alloc]init];
_cache.countLimit = 500;
}
return _cache;
}
@end