/usr/lib/python2.7/dist-packages/crmsh/cache.py is in crmsh 3.0.1-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de>
# See COPYING for license information.
#
# Cache stuff. A naive implementation.
import time
_max_cache_age = 600 # seconds
_stamp = time.time()
_lists = {}
def _clear():
global _stamp
global _lists
_stamp = time.time()
_lists = {}
def is_cached(name):
if time.time() - _stamp > _max_cache_age:
_clear()
return name in _lists
def store(name, lst):
_lists[name] = lst
return lst
def retrieve(name):
if is_cached(name):
return _lists[name]
return None
# vim:ts=4:sw=4:et:
|