Nir Soffer has posted comments on this change.
Change subject: cache: Add caching decorator with invalidation
......................................................................
Patch Set 4:
(1 comment)
http://gerrit.ovirt.org/#/c/34709/4/lib/vdsm/cache.py
File lib/vdsm/cache.py:
Line 100: stats = os.stat(self.path)
Line 101: except OSError as e:
Line 102: if e.errno != errno.ENOENT:
Line 103: raise
Line 104: stats = None
I think in this case you should return True.
I don't think
so. file_modified should invalidate the cache when a file was modified. If the file was
missing the previous call, and is still missing, there is no need to invalidate the cache,
since no modification happened.
For case when missing file should invalidate the cache on each call you can use another
validator. I don't see a real use case that needs this.
Line 105: else:
Line 106: stats = stats.st_ino, stats.st_size, stats.st_mtime
Line 107: if stats != self.stats:
Line 108: self.stats = stats
--
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: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Adam Litke <alitke(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: Martin Sivák <msivak(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