/usr/share/pyshared/jsb/lib/cache.py is in jsonbot 0.84.4-1.
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 39 40 41 42 43 44 45 46 | # jsb/cache.py
#
#
""" jsb cache provding get, set and delete functions. """
## jsb imports
from jsb.utils.lazydict import LazyDict
## basic imports
import logging
## defines
cache = LazyDict()
## functions
def get(name, namespace=""):
""" get data from the cache. """
global cache
try:
#logging.debug("cache - returning %s" % cache[name])
return cache[name]
except KeyError: pass
def set(name, item, timeout=0, namespace=""):
""" set data in the cache. """
#logging.debug("cache - setting %s to %s" % (name, str(item)))
global cache
cache[name] = item
def delete(name, namespace=""):
""" delete data from the cache. """
try:
global cache
del cache[name]
logging.warn("cache - deleted %s" % name)
return True
except KeyError: return False
def size():
return len(cache)
|