Last retrieved data accessible in model?..

View: New views
2 Messages — Rating Filter:   Alert me  

Last retrieved data accessible in model?..

by jayarjo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



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 cake-php@...
To unsubscribe from this group, send email to cake-php+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Last retrieved data accessible in model?..

by jperras :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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 <jaya...@...> 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 cake-php@...
To unsubscribe from this group, send email to cake-php+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---