Page 1 of 1

Re: event hook for plugin configuration save?

Posted: Mon Jun 13, 2005 3:38 pm
by garvinhicking
There'd be two ways to do that:

1. Use PEAR::Cache_Lite to only parse the key/value pairs once in frontend_display and then fetch the return array to operate on

2. Serialize the result of your variable munging into an array and then store that array via set_config which you can then later user

Apart from that, your Plugin will also improve pretty much when using the entryproperties caching; then it will parse your glossary/definitions only once per entry and the next time only when you modify the entry. :)

Regards,
Garvin

Posted: Mon Jun 13, 2005 6:47 pm
by garvinhicking
Hi Rob!

Yes, the entryproperties caching is a seperate plugin, bundled. It's called "Extended Properties" and has a config option for caching. That's also what the "cachable events" hooks are for. You can look at the contentrewrite plugin or the bbcode plugin, both properly define those events and are skipped if a cached presentation of your entry is used.

About suggestion 2, that's not exactly what I meant. It would be more like:

1. Leave introspection as is
2. When your frontend_display is called you do things like:
foreach ($config AS $bla) {
...
}
And after that you'll do a str_replace($from, $to, $entry['body']) or something like that, right?
What I image now would be that you put the whole foreach() stuff where you fetch items like this:
- require the PEAR::Cache Lite
- Use the Function cache (I don't know the commands by hand; look at the DNSURBL spamblock plugins, they use the PEAR Lite Function cache)
- Store $from and $to in the cache
- Use $frmo and $to from the cache, if PEAR Cache returns that to you; only if it's not existing do the repetition

Best regards,
Garvin

Posted: Tue Jun 14, 2005 12:11 pm
by garvinhicking
There is no propper guide, so I'd just follow the example of bbcode. I think the easiest cache-supporting plugin is the serendipity_event_nl2br plugin. That does not have as much overhead like bbcode or emoticate...

Regards and have fun,
Garvin