Giter VIP home page Giter VIP logo

kache's Issues

问一个小问题

Kache支持一些放到NSArray里面的自定义对象么?好多情况下会有这样的情况~

请问作者为什么每次重新启动app,获取不到缓存数据呢?

我在一个需要缓存数据的页面对数据进行了缓存:
[Kache setValue: inDefaultPoolForKey: expiredAfter:];用的这个方法。
然后在appdelegate里面添加了如下代码:

  • (void)applicationWillResignActive:(UIApplication *)application
    {
    [Kache save];
    }
  • (void)applicationDidEnterBackground:(UIApplication *)application
    {
    [Kache save];
    }
    但是,如果不重启app,到这个页面是可以获取到缓存数据的。只要重启app就拿不到混存数据了。
    请问作者该怎么做到可以app重启之后依然可以拿到混存数据呢?

不太明白为何每次取出缓存数据之后要立即将其删除

KHolder类中的objectForKey方法,每次取出缓存数据之后,都立即将已保存在本地的文件删除,所以造成当离线使用时,第一次能看到数据,之后就再也看不到了。这点让人觉得很奇怪,不是应该等过期了再删除吗?

[KHolder archiveData]导致crash

*** -[NSArray initWithArray:range:copyItems:]: range {0, 2} extends beyond bounds 0 .. 0
(
0 CoreFoundation 0x37c1e8d7 __exceptionPreprocess + 186
1 libobjc.A.dylib 0x3776a1e5 objc_exception_throw + 32
2 CoreFoundation 0x37b7829b -[NSArray initWithArray:range:copyItems:] + 450
3 CoreFoundation 0x37b8c2b9 -[NSArray mutableCopyWithZone:] + 84
4 shoot 0x100645 __22-[KHolder archiveData]_block_invoke + 292
5 libdispatch.dylib 0x307d7d55 _dispatch_call_block_and_release + 12
6 libdispatch.dylib 0x307da897 _dispatch_worker_thread2 + 258
7 libsystem_c.dylib 0x376dd1cf _pthread_wqthread + 294
8 libsystem_c.dylib 0x376dd0a4 start_wqthread + 8
)

              *** -[NSArray initWithArray:range:copyItems:]: range {0, 3} extends beyond bounds [0 .. 1]

(null)
(
0 CoreFoundation 0x354d68a7 __exceptionPreprocess + 186
1 libobjc.A.dylib 0x3787d259 objc_exception_throw + 32
2 CoreFoundation 0x35430263 -[NSArray initWithArray:range:copyItems:] + 450
3 CoreFoundation 0x35444289 -[NSArray mutableCopyWithZone:] + 84
4 shoot 0x100645 __22-[KHolder archiveData]_block_invoke + 292
5 libdispatch.dylib 0x34363c59 _dispatch_call_block_and_release + 12
6 libdispatch.dylib 0x34366817 _dispatch_worker_thread2 + 258
7 libsystem_c.dylib 0x32893dfb _pthread_wqthread + 294
8 libsystem_c.dylib 0x32893cd0 start_wqthread + 8
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.