Data cache solution

Source: Internet
Author: User
Data cache solution by Wu Xueying

Today, I think about a caching solution suitable for my project. I have basically tried it (I used CoreData all the time). 1. coredata: use MagicalRecord + Mogenerator to create a table and write a lot of parsing code. No need to resolve it. This is troublesome. serialization

[NSKeyedArchiver archiveRootObject: model toFile: path];

[NSKeyedUnarchiver unarchiveObjectWithFile: path];

Good and convenient, but I always feel that the experience is not good. After testing the method time, when the model size is large, the resolution time is basically more than MS, I gave up using 3. sqllite uses an open-source key-value Library recommended by Tang Qiao in the early stage, which is easy to use.

[[WTUtilsshared]. dbclearTable: @ "RestList"];

[[WTUtilsshared]. dbputObject: responsewithId: @ "restList" partition table: @ "RestList"];

Combined with today's Mantle

-(Void) loadSavedData {dispatch_async (dispatch_get_global_queue (0, 0), ^ {id data = [WTUtils shared]. db getObjectById: @ "restList" fromTable: @ "RestList"]; restListArray = [WTRestListEntity getRestListArray: data]; if (restListArray! = Nil) {DELAYEXECUTE (0.0, [_ tableView reloadData]);} else {[ZAActivityBar showWithStatus: @ "loading..."] ;}});}
Finally, the cache effect is good, the code operation is simple, and the operability is good.



Data cache solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.