Memoize invalidate BrowserView

Hi,
is there a way to invalidate a BrowserView?

I collect all my NewsItems in @@news and call in everywhere.

Now I want to recreate the view on ObjectModified (or IActionSucceededEvent)...

But a simple Event subscriber with
```global_cache.invalidate('package.path.to.view.NewsAggregated')````
does nothing

my Function


@ram.cache(lambda *args: time.time() // (60 * 3600))
def NewsAggregated(self, location):

    portal_catalog = api.portal.get_tool(name='portal_catalog')

    results = portal_catalog(
        path={
            'query': location
        },
        portal_type=['News Item'],
        review_state='published',
        sort_on='effective',
        sort_order='reverse'
    )

    .... other stuff
    return [Newsitems Dicts]

For sure popping out the annotations will work:

I am not aware of a smarter method.

2 Likes

This comment saved the day, thx! :slight_smile:

1 Like