Fetching with a certain number and some offset with Realm(https://realm.io/) -
i trying turn realm(https://realm.io/) , come across problem. if handling data base storing large number of records, , want fetching number of records offset, how can realm. know, can done sql or core data. , don't want fetch data base , caculate ourselves in memory, needs time
since realm reads data disk upon access (even down property level), don't have worry reading more disk necessary. if want access next 10 objects after 100th, have skip accessing first 100.
for example:
let realm = realm() let modelobjects = realm.objects(mymodel) // => there 1000 items in 100..<110 { let itematindex = modelobjects[i] // => inferred of type `mymodel` itematindex.someproperty // => @ point data *just property* read disk // perform operations in memory here... } // @ point, 10 objects ever read disk // , properties on objects accessed.
i'm using realm swift in example, same concepts apply realm objective-c.
Comments
Post a Comment