Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement purge support for event occurrences #317

Open
frisi opened this issue Jul 15, 2020 · 0 comments
Open

implement purge support for event occurrences #317

frisi opened this issue Jul 15, 2020 · 0 comments

Comments

@frisi
Copy link
Contributor

frisi commented Jul 15, 2020

just added this adapter to my package. should we add the same to plone.app.event?

from z3c.caching.interfaces import IPurgePaths

class EventOccurrencesPurgePaths(object):
    """purges urls for event occurrences
    """
    implements(IPurgePaths)
    adapts(IMyEvent)

    def __init__(self, context):
        self.context = context

    def getRelativePaths(self):
        prefix = self.context.absolute_url_path()
        result = []
        for occ in IRecurrenceSupport(self.context).occurrences():
            if occ.portal_type == 'Occurrence':
                result.append(prefix + '/' + occ.id)
        return result

    def getAbsolutePaths(self):
        return []

side note: first i tried to purge with a regex/glob character (eg <event-id>[\d-]*). but looks like this is what BANs are for in varnish (https://varnish-cache.org/docs/4.1/users-guide/purging.html). however, it looks like plone.cachepurging only issues PURGE requests only by default so the exact urls are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant