Last retrieved data accessible in model?..

2 messages Options
Embed this post
Permalink
Davit Barbakadze

Last retrieved data accessible in model?..

Reply Threaded More More options
Print post
Permalink


I wonder whether data retrieved by last query (as a result of Model-
>find() for example) is accessible in some internal Model variable?

I'm trying to build custom datasource and one of the ideas was to
store last retrieved data in there somewhere, but I'm not sure whether
this is established practice.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

jperras

Re: Last retrieved data accessible in model?..

Reply Threaded More More options
Print post
Permalink

How would you get it to persist between requests?

`var $cacheQueries = true;` will cache the results of model queries in
memory, which might be what you're looking for. If you're looking for
something that can persist the last accessed data across requests, I'd
implement what you're describing by implementing a Model::afterFind()
in your app_model which caches the results.

-jperras.

On Nov 7, 4:06 am, jayarjo <[hidden email]> wrote:
> I wonder whether data retrieved by last query (as a result of Model-
>
> >find() for example) is accessible in some internal Model variable?
>
> I'm trying to build custom datasource and one of the ideas was to
> store last retrieved data in there somewhere, but I'm not sure whether
> this is established practice.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---