Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用YYCache缓存IM私信可不可行 #127

Open
BigWhiteEat opened this issue Jun 7, 2018 · 1 comment
Open

用YYCache缓存IM私信可不可行 #127

BigWhiteEat opened this issue Jun 7, 2018 · 1 comment

Comments

@BigWhiteEat
Copy link

我用YYCache缓存IM来的私信,在全剧队列里缓存。
代码片段:

YYCache *cache = [BaseController sharedCacheManager]; //返回一个static cache
NSMutableDictionary *userDataDic = [[NSMutableDictionary alloc]initWithDictionary:(NSDictionary *)[cache.diskCache objectForKey:account]];

xxxx操作xxxxx

[cache.diskCache setObject:userDataDic forKey:account];

这么做有问题吗?因为私信可能随时会有,有可能造成前一个私信缓存未完成,就来了有下一个需要缓存的私信。

@atom2ueki
Copy link

@BigWhiteEat yycache里面是带锁的,只要是同一个db文件,前面的缓存没做完下一个不会开始,整体是thread safe的应该不会有问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants