Instantiating Mandango without a cache

34 views
Skip to first unread message

Bar Ziony

unread,
Mar 6, 2013, 1:55:19 PM3/6/13
to mandang...@googlegroups.com
Hey,

Is it possible to Instansiate Mandango without a cache?
What is the purpose of the cache exactly? When does it kick in?

Thanks,
Bar.

Pablo Díez

unread,
Mar 6, 2013, 2:01:04 PM3/6/13
to mandang...@googlegroups.com
It caches the fields you query automatically: http://mandango.org/doc/mandango/query-cache.html

It's very worth using it, but if you don't want you can simply use ArrayCache, which doesn't persist anything between requests: https://github.com/mandango/mandango/blob/master/src/Mandango/Cache/ArrayCache.php

--
You received this message because you are subscribed to the Google Groups "Mandango Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mandango-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bar Ziony

unread,
Mar 6, 2013, 2:16:50 PM3/6/13
to mandang...@googlegroups.com
I don't understand one thing in that page:

When you use the getters for a model, each getter is going to MongoDB and getting the document over and over again? Or does Mandango getting it just one time (when you do the first getter for example, or when you do the findById()?) ?

Thanks!
Bar.


--
You received this message because you are subscribed to a topic in the Google Groups "Mandango Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mandango-users/ZMmmPu_dawk/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to mandango-user...@googlegroups.com.

Pablo Díez

unread,
Mar 6, 2013, 2:20:45 PM3/6/13
to mandang...@googlegroups.com
On Wed, Mar 6, 2013 at 8:16 PM, Bar Ziony <b...@photomania.net> wrote:
I don't understand one thing in that page:

When you use the getters for a model, each getter is going to MongoDB and getting the document over and over again? Or does Mandango getting it just one time (when you do the first getter for example, or when you do the findById()?) ?

Mandango does it one time, and then it's cached and all used fields in the query are queried together. You can test an example by using a logger.

Bar Ziony

unread,
Mar 6, 2013, 2:22:07 PM3/6/13
to mandang...@googlegroups.com
Why Mandango gets only the _id in the first time? Not that it matters a lot since it's only the first request, just to know.

Pablo Díez

unread,
Mar 6, 2013, 2:30:36 PM3/6/13
to mandang...@googlegroups.com
Because it's the only required field to know which document it is.

Bar Ziony

unread,
Mar 6, 2013, 2:33:55 PM3/6/13
to mandang...@googlegroups.com
Yep, but if I just did: findById, and all I get from MongoDB is the _id - isn't that redundant ?

Pablo Díez

unread,
Mar 6, 2013, 2:43:09 PM3/6/13
to mandang...@googlegroups.com
The id is always returned )
Reply all
Reply to author
Forward
0 new messages