Skip to content

[ENH] Allow caching of LIST wiki-plugins, including generic way to define cache purge rules that trigger whenever specified items are saved.

Nelson Ko requested to merge synergiq/tiki:synergiq-list-plugin-cache into master

NOTE that I also submitted another merge request that included the changes here in squashed form as that one was build on top of this one. !85 (closed) It might be easier to merge that one.

Basically this allows the output of LIST wiki-plugins to be cached. The hash of the plugin $data is used as the cache key so the cache is unique to each plugin. The default is off and you can turn each plugin to be cached by setting the cache=y parameter. There is also a global pref that can change the default to all on (which is useful if you just want to speed things up site-wide quickly at the expense of seeing stale output, you can then prevent individual plugins from being cached using the cache=n parameter). You can also set a cache expiry time per LIST plugin or let it take the global default pref setting.

There is also a way to specify for each cached LIST plugin to invalidate it when certain Tiki object(s) are saved/updated. You can also set rules such as "any trackeritem in Tracker x" in addition to just "trackeritem x". This part is generic code that is in cachelib and can be used for other applications for cache invalidation on object saving as well.

I have also updated the admin panel (control panel) screen for Search, i.e. tiki-admin.php?page=Search to put all the caching options together and also elaborated in the help text and labels for the other caching features so as to try to make it clearer what each does.

Once this merge request accepted I will improve the documentation at https://doc.tiki.org/PluginList.

There are some planned enhancements but that can come later.

(1) Ability to handle pagination (offset var might need to be provided as a plugin param). Included in !85 (closed), but without that, if your LIST plugin paginates, you will need to make sure that the offset in the query string (through {{offset_var}} or $smarty.get.offset_var (if Smarty template) appears in the body of the plugin for it to work with pagination, e.g. {options offset={{offset_var}}}

(2) Easily have 2 different caches, one for logged in users and one for logged out users. Included in !85 (closed)

(3) Have a different cache per group (based on users' default group). Future.

@jonnybradley You might be interested in this too as you did 69df735a.

Edited by Nelson Ko

Merge request reports