[development] Object Caching in DRUPAL-7?

Jose A. Reyero drupal at reyero.net
Mon Feb 23 12:13:18 UTC 2009


Very good point, Catch,

I think this global object caching is a good idea, but for it to be 
really useful we need that global object handling too (Nedjo's patch, 
http://drupal.org/node/365899 ), and in general we need some object API.

Once we have that 'object API' in place adding some uniform caching for 
objects would be much easier. Then node_load, user_load, etc can be just 
wrappers for the drupal_load() function and we can have a really 
functional cache, which also invalidates cached objects when a 'write' 
operation is done.

Add in drupal_load_multiple() and we have a really powerful thing. So I 
think we should move on first with that patch, then adding the global 
caching feature will be trivial.

Nathaniel Catchpole wrote:
> There's a patch for node_load() here - http://drupal.org/node/111127 - 
> has been sitting at RTBC for weeks though and just gone stale again.
>
> Since terms, users (hopefully, soon) etc. have almost exactly the same 
> code for loading now, it'd be easy to add the same pattern there too, 
> and I was thinking about trying that if node_load() gets in.
>
> The new core field API also allows objects to declare themselves as 
> already cached - so the field cache is skipped for those objects and 
> we save filling up memcache bins with the same stuff, so no issues there.
>
> However I'm not sure what you mean by a global object caching strategy 
> - actually the same code? Or just parallel APIs? Nedjo Rogers has a 
> patch for the former at http://drupal.org/node/365899 - adding 
> cache_set/get to it wouldn't be hard at all (at least when loading by 
> IDs, which is all we need really). Although I'd be tempted to add the 
> caching in separate patches then unify it all later rather than trying 
> to do both at once.
>
> +1, anyway.
>
> Nat
>
>
>
>
>     Josh Koenig wrote:
>
>         Greetings,
>
>         I'd like to take the community's temperature on developing a
>         global object caching strategy for drupal core 7.0. In effect,
>         this would mean pulling the functionality of advcache module
>         into core, though the code would doubtless be a bit different.
>
>         This has been previously discussed by Robert Douglass and
>         Steve Rude, and I think both the short-term and strategic
>         value here is clear. As memcached permeates the collective
>         consciousness of the web-development community, and as "cloud"
>         computing becomes more and more prevalent, best practices in
>         architecture increasingly point towards caching full objects
>         whenever possible.
>
>         This also fits well with Drupal's existing architecture. There
>         are great functional points (e.g. node_load()) to mount this
>         functionality.
>
>         I'm certain I'm not the only one thinking along these lines.
>         Anyone want to throw out their ideas?
>
>         cheers
>         -josh
>
>



More information about the development mailing list