SpiffyTitles: cacheGlobal config option

This commit is contained in:
oddluck 2020-06-21 03:19:57 +00:00
parent 23443ee6bd
commit 5b9997ff9e
2 changed files with 9 additions and 0 deletions

View File

@ -129,6 +129,13 @@ conf.registerGlobalValue(
registry.Integer(600, _("""Link cache lifetime in seconds""")), registry.Integer(600, _("""Link cache lifetime in seconds""")),
) )
# Link cache lifetime
conf.registerGlobalValue(
SpiffyTitles,
"cacheGlobal",
registry.Boolean(False, _("""Keep link title cache globally""")),
)
conf.registerChannelValue( conf.registerChannelValue(
SpiffyTitles, SpiffyTitles,
"ignoredMessagePattern", "ignoredMessagePattern",

View File

@ -248,6 +248,8 @@ class SpiffyTitles(callbacks.Plugin):
Check if we have this link cached according to the cache lifetime. If so, serve Check if we have this link cached according to the cache lifetime. If so, serve
link from the cache instead of calling handlers. link from the cache instead of calling handlers.
""" """
if self.registryValue("cacheGlobal"):
channel = "global"
cached_link = self.get_link_from_cache(url, channel) cached_link = self.get_link_from_cache(url, channel)
if cached_link: if cached_link:
title = cached_link["title"] title = cached_link["title"]