1

This questions is related to Kohana ORM AND Caching module. I use version 3.2 if it matters. I tried to research trust me, but I really couldn't find some good answer... so here it is:

  1. What are the correct ways to use ORM::cached() and ORM::serialize() and ORM::$reload_on_wakeup?
    I've seen many 2-line code examples but never anything really solid on the userguide/api...

  2. What is the difference between enabling Cache module and 'caching' => true in Kohana::init?

  3. Anyone has any recommended approach for the following specific situations? I have a catalogue page that upon profiling, I realized two very expensive actions:

    • I queried database each time for a currency model for each item, when the currency information can really be reused.
    • I queried database each time for each item's inventory item, this is an expensive query, which I wish I can cache until inventory level changes.

References that I found but couldn't answer fully my questions:
http://forum.kohanaframework.org/discussion/1782/tip-for-caching-orm-objects/p1 http://forum.kohanaframework.org/discussion/10600/does-kohana-orm-and-cache-work-together/p1

Lim
  • 329
  • 2
  • 15

1 Answers1

0

Just found your question, maybe too late, but maybe is useful to others:

  1. cached, will force the Query builder to cache the DB query. It uses the KOhana:cache method (file cache) I am trying to find a workaround for this.
  2. enables caching for the file search as says in the Kohana/Core.php file: Whether to use internal caching for [Kohana::find_file], does not apply to [Kohana::cache]. Set by [Kohana::init]
  3. Enable caching true to speed up the file search, and enable the cache module, I am working on a way to cache the queries of DB using the instance used by the module. That would be better than using the file cache. Maybe I am missing something but stuck there right now.
chema
  • 531
  • 6
  • 15