Files
peko-ios/YuMi/Modules/YMMessage/View/Session/SessionRiskCache.m
2023-07-14 18:50:55 +08:00

51 lines
839 B
Objective-C

//
// SessionRiskCache.m
// YUMI
//
// Created by YUMI 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