Plone 更新新闻项目的附加图像不会从varnish中清除缩放图像,而只清除新闻项目视图
每当用户替换/更新附加到新闻项的图像时,上面列出的新闻项视图和文件夹都会在varnish缓存中清除(更新),但附加的图像本身不会 如何使plone.app.caching不仅能清除/更新Plone 更新新闻项目的附加图像不会从varnish中清除缩放图像,而只清除新闻项目视图,plone,varnish,linguaplone,plone-4.x,Plone,Varnish,Linguaplone,Plone 4.x,每当用户替换/更新附加到新闻项的图像时,上面列出的新闻项视图和文件夹都会在varnish缓存中清除(更新),但附加的图像本身不会 如何使plone.app.caching不仅能清除/更新/news/和/news/news item/,还能清除/更新/news/news item/image\u news\u scale和/news/news item/image\u甚至更小的\u news\u scale下的图像 背景:使用Plone 4.3.2,我通过/@@imaging controlpan
/news/
和/news/news item/
,还能清除/更新/news/news item/image\u news\u scale
和/news/news item/image\u甚至更小的\u news\u scale
下的图像
背景:使用Plone 4.3.2,我通过/@@imaging controlpanel
设置了自己的自定义图像比例,例如新闻比例
。此比例用于显示新闻项目中的附加图像,例如作为/news/news item/image\u news\u比例
。此外,我还有另一个自定义图像比例,如用于文件夹列表的/news/news item/image\u event\u news\u scale
。我通过/portal\u skins/custom
创建了这些视图,并将它们注册为/portal\u types/
和选择默认视图
操作下的默认视图
PS我刚才看到的,因为我正在使用,图像的URL甚至可以在一个更复杂的URL下使用,这个URL取决于所选的语言:
/news/news item/image\uuuuu de\uuuu news\uu scale
和/news/news item/image\uu de\uuu de\uu甚至更小的新闻比例
(de
也可以是en
,取决于语言)如果您已经在plone.app.caching中正确配置了缓存清除,您会注意到默认情况下,newsitem/image\u thumb和其他图像大小将正确清除
plone.app.caching不知道图像的自定义URL,因为raptus.linguaplone。
因此,您必须创建自己的适配器,为您的新闻项实现IPurgePaths
像这样的事情应该可以做到:
from z3c.caching.interfaces import IPurgePaths
class ItemImagePurgePaths(object):
"""additional paths to purge not covered by
plone.app.caching default adapters i.e. ObjectFieldPurgePaths
"""
implements(IPurgePaths)
adapts(IYourConentType)
def __init__(self, context):
self.context = context
def getRelativePaths(self):
prefix = self.context.absolute_url_path()
return [prefix + '/image____de____news_scale',
prefix + '/image____de____even_smaller_scale']
def getAbsolutePaths(self):
return []
另见