MCPcopy Index your code
hub / github.com/clips/pattern / age

Method age

pattern/web/cache/__init__.py:119–123  ·  view source on GitHub ↗

Returns the age of the cached item, in days.

(self, k)

Source from the content-addressed store, hash-verified

117 raise KeyError, k
118
119 def age(self, k):
120 """ Returns the age of the cached item, in days.
121 """
122 p = self._hash(k)
123 return os.path.exists(p) and (date_now() - date_modified(p)).days or 0
124
125 def clear(self, age=None):
126 """ Clears all items from the cache (whose age is the given amount of days or older).

Callers 1

test_cacheMethod · 0.80

Calls 4

_hashMethod · 0.95
date_nowFunction · 0.85
date_modifiedFunction · 0.85
existsMethod · 0.80

Tested by 1

test_cacheMethod · 0.64