Popular recipes tagged "age"http://code.activestate.com/recipes/tags/age/2014-02-02T21:28:25-08:00ActiveState Code Recipeslru_timestamp - cache entry aging for functools.lru_cache (Python)
2014-02-02T21:28:25-08:00Peter Santorohttp://code.activestate.com/recipes/users/4189027/http://code.activestate.com/recipes/578817-lru_timestamp-cache-entry-aging-for-functoolslru_c/
<p style="color: grey">
Python
recipe 578817
by <a href="/recipes/users/4189027/">Peter Santoro</a>
(<a href="/recipes/tags/age/">age</a>, <a href="/recipes/tags/lru_cache/">lru_cache</a>).
</p>
<p>Return a timestamp string for @lru_cache decorated functions.</p>
<p>The returned timestamp is used as the value of an extra parameter
to @lru_cache decorated functions, allowing for more control over
how often cache entries are refreshed. The lru_timestamp function
should be called with the same refresh_interval value for a given
@lru_cache decorated function. The returned timestamp is for the
benefit of the @lru_cache decorator and is normally not used by
the decorated function.</p>
<p>Positional arguments:
refresh_interval -- in minutes (default 60), values less than 1
are coerced to 1, values more than 1440 are
coerced to 1440</p>
Find the oldest (or yougest) of a list of files (Python)
2009-06-10T16:08:13-07:00Micah Elliotthttp://code.activestate.com/recipes/users/2649403/http://code.activestate.com/recipes/576804-find-the-oldest-or-yougest-of-a-list-of-files/
<p style="color: grey">
Python
recipe 576804
by <a href="/recipes/users/2649403/">Micah Elliott</a>
(<a href="/recipes/tags/age/">age</a>, <a href="/recipes/tags/files/">files</a>, <a href="/recipes/tags/find/">find</a>, <a href="/recipes/tags/queue/">queue</a>).
</p>
<p>Sometimes you need to perform an operation on the oldest of a set of files. Using <em>get_oldest_file</em> you could implement an age-based priority queue that processes files from oldest to newest. The list of files you pass in may be from a <em>glob</em> of a single directory or some more elaborate search routine.</p>