Actually, I think I see the answer to my second quesiton, which is that the 
models have strong pointers to the CBLDocuments, so as long as they aren't 
dealloc'd, the documents won't be evicted from the cache. I hope that 
thinking is right. Given that, it seems that an NSCache of CBLModels 
shouldn't cause problems, right?

On Sunday, May 4, 2014 4:10:41 AM UTC-7, Ragu Vijaykumar wrote:
>
> I've been hitting a performance issue that I'm not sure how to fix 
> exactly. I have a lot of large read-only documents that I'm mapping out as 
> objects with id<CBLJSONEncoding>. Usually, I use queries and get the 
> row.document, and then make my CBLModels, and then access the models 
> properties, which are heavily nested CBLJSONEncoding classes. The creation 
> of these models is expensive as I've found through my debugging, and they 
> are constantly being destroyed since I'm using getters only for local 
> information.
>
> From what I've seen in the source for Couchbase, it seems that CBLDocument 
> only stores a weak pointer to the CBLModel, and only CBLModels which are 
> changed and set the needsSave flag are prevented from being dealloc'd as 
> they are added to an unsavedMutableSet. 
>
> *I was wondering if there might be any bad side-effects if I were to 
> create an NSCache for my read-only CBLModels?* 
>
> In particular, I'm still not sure how CBLDocuments are deallocated and 
> whether this would impact my pre-existing CBLModels. *I see that the 
> documents are added to a CBLCache, but how are they checked to see if a 
> models that wraps around them have the unsaved properties when the cache 
> wants to clear them?* I looked around for calls to document.modelObject, 
> but didn't find much.
>
> Any insights into this would be greatly appreciated.
>
> Cheers,
> Ragu
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/5637a4e2-fcfc-44bb-a8dd-ac1121594f09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to