pinterest / PINCache

Fast, non-deadlocking parallel object cache for iOS, tvOS and OS X

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Data emptying

bapidashu opened this issue · comments

Hello, Sir
I use [PINCache sharedCache] in the APP to cache data.
But when I came over and opened the APP for a while, I found that all my cached data had been cleared.
[PINCache sharedCache] can cache data on disk and memory, why my data on disk is also cleared?
Data emptying

PINDiskCache磁盘缓存默认限制了50M, 超过大小会被自动清理. @bapidashu

好的,非常感谢

/**
The maximum number of bytes allowed on disk. This value is checked every time an object is set, if the written
size exceeds the limit a trim call is queued. Defaults to 0.0, meaning no practical limit.

*/
@Property (assign) NSUInteger byteLimit;

但是我看他源码说默认是没有限制的啊,那么这个50M是从哪里得来的呢

好吧,那意思说我如果不需要限制的话,就需要将这个byteLimit 设置为0就好了么

好吧,那意思说我如果不需要限制的话,就需要将这个byteLimit 设置为0就好了么

是的. 当代码是这样的.

Hello, did you solve your issue (sorry, I can't read many Chinese characters)? If you don't want the cache to delete your data you'll want to set an infinite size and time limit. Do note however, this is a cache and the disk cache is stored in your apps cache directory. This means the operating system can delete it at any time.

Hello, did you solve your issue (sorry, I can't read many Chinese characters)? If you don't want the cache to delete your data you'll want to set an infinite size and time limit. Do note however, this is a cache and the disk cache is stored in your apps cache directory. This means the operating system can delete it at any time.

Thank you very much for your reply.

Yes, I understand that the cache is cleared.
But why is the data stored on the disk also cleared? And every time it's cleared with the cache, it's confusing to me.
And I've set the storage size and time to be infinite.
I also found this problem on only older models (I used the iPhone6sPlus, and there were some issues with the device's main board).
Is this a problem only for a particular device?
I haven't found the answer yet.

@bapidashu sorry for the delayed reply. I don't think there are any problems with particular devices, but the it's possible the operating system clears caches on different devices at different times / rates… Could it be that certain devices have less disk space?