Caching for My Plugin

My plugin relies on 3rd party urls getting examined and their server uptime, not via database storage that XenForo is running on. (would this be a better solution?)

I found several examples online, but apparently the XenForo templating system doesn't agree with the examples since I get Template Error: Page_Container. I tried inserting the code line in the templateHook call to my chagrin. (ie: after the finding the correct hook: ob_start(), before the main code, and just after $contents .= $pluginContents; ob_clean() or whathaveyou)

I also get fopen permission errors for the cache file and the folder and cache file for writing, even the script itself is set to www-data.www-data and all are given write permissions.

Has anyone gotten a cache system to work for their plugin? Or maybe you leveraged the Zend Framework somehow? If so on either question, please let me know.

Thank you!


Well-known member
Depending on the frequency that you need to access this data, you could use the database with your own table to store the data and query your table when you need to lookup info on these urls, the XF simple cache (which I believe gets loaded on every page load), or whatever is the configured back end cache i.e. memcache.

If you only need to lookup the info when a post is made, I would go with the database option, but you didn't give more specifics so it's hard to say.