Howto cache via entryproperties?

Discussion corner for Developers of Serendipity.
Post Reply
onli
Regular
Posts: 2830
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Howto cache via entryproperties?

Post by onli »

I don't understand the mechanism of the entryproperties-cache even though the trackexits-plugin should be an example.

In cacheable plugins, install() is used to cache the curretn state and uninstall() to empty the cache. Let's have a plugin using entry_display. If there'd be a useable cache, it should be possible to transform the code executed in the event somehow so it only gets executed from time to time. Like a man in the middle, catching the critical part of the function and returning the old result if the timeout is not over yet - and only if it's over, the expensive operation should be done.

trackexit is using 'frontend_display_cache', but that hook is never caught in the entryproperties-plugin, only executed once. How do they interact, how is it possible to cache the transormations done by a markup-plugin (or the tweet-this-button of the twitter-plugin) via entryproperties?
sincerely
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Howto cache via entryproperties?

Post by garvinhicking »

Hi!

You don't happen to have my book? I think I wrote down the workings of this in depth inside the book.

The basic idea is that the plugin registers the frontend_display_cache event, do its logic there, and override any action from the usual frontend_display if the cache is not currently built.

install/uninstall is really only to update the cache onetime, for constant updates it all works through even thooks.

entryproperties cache really onjly acts on that single event, no other things are cached through entryproperties, only the markup transformations.

Regards,
GArvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
onli
Regular
Posts: 2830
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Howto cache via entryproperties?

Post by onli »

Hi Garvin
Thanks for the explanation. Think I'll have to read your book next time a question like this occurs :)
Post Reply