various changes (not anything like an app yet)
[nltk_ontology_framework.git] / src / util / cache_util.py
blob7548d4b6e790b5ea7a9a3bfb3d727e84f55c10e6
1 # This Python file uses the following encoding: utf-8
2 '''
3 Created on May 5, 2011
5 @author: mjacob
6 '''
7 import os
8 import yaml
10 def is_cached(dir, name, component):
11 return os.path.exists(os.path.join(dir, name, component))
13 def get_cache(dir, name, component):
14 return yaml.load(os.path.join(dir, name, component))
16 def set_cache(dir, name, component, object):
17 if not os.path.exists(os.path.join(dir, name)):
18 os.mkdir(os.path.join(dir, name))
19 yaml.dump(object, open(os.path.join(dir, name, component), 'w'))