Nir Soffer has posted comments on this change.
Change subject: cache: Add caching decorator with invalidation
......................................................................
Patch Set 2:
(1 comment)
http://gerrit.ovirt.org/#/c/34709/2/lib/vdsm/cache.py
File lib/vdsm/cache.py:
Line 22: import os
Line 23: import functools
Line 24:
Line 25:
Line 26: def memoized(update=None):
The API is really nice, but I find this 'update' a too
generic name.
update_on looks nice when you define decorate:
@memoize(update_on=file_modified())
But it is not as nice when used inside the decorator:
if update_on is not None and update_on():
cache.clear()
I think that replacing "validate" with "update" is a good way to keep
everyone happy.
Line 27: """
Line 28: Return a caching decorator supporting invalidation.
Line 29:
Line 30: The decorator accepts an optional "update" callable, called each
time the
--
To view, visit
http://gerrit.ovirt.org/34709
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I6dd8fb29d94286e3e3a3e29b8218501cbdc5c018
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes