Esempio n. 1
0
    def __init__(self, dep_cache, obj_cache, routes_cache, pod):
        self._pod = pod

        self._collection_cache = collection_cache.CollectionCache()
        self._document_cache = document_cache.DocumentCache()
        self._file_cache = file_cache.FileCache()

        self._dependency_graph = dependency.DependencyGraph()
        self._dependency_graph.add_all(dep_cache)

        self._object_caches = {}
        self.create_object_cache(self.KEY_GLOBAL,
                                 write_to_file=False,
                                 can_reset=True)

        for key, item in obj_cache.iteritems():
            # If this is a string, it is written to a separate cache file.
            if isinstance(item, basestring):
                cache_value = {}
                if self._pod.file_exists(item):
                    cache_value = self._pod.read_json(item)
                self.create_object_cache(key, **cache_value)
            else:
                self.create_object_cache(key, **item)

        self._routes_cache = grow_routes_cache.RoutesCache()
        self._routes_cache.from_data(routes_cache)
Esempio n. 2
0
File: podcache.py Progetto: ilg/grow
    def __init__(self, yaml, pod):
        self._pod = pod

        self._collection_cache = collection_cache.CollectionCache()
        self._document_cache = document_cache.DocumentCache()

        self._dependency_graph = dependency.DependencyGraph()
        self._dependency_graph.add_all(yaml.get(self.KEY_DEPENDENCIES, {}))

        self._object_caches = {}
        self.create_object_cache(self.KEY_GLOBAL,
                                 write_to_file=False,
                                 can_reset=True)

        existing_object_caches = yaml.get(self.KEY_OBJECTS, {})
        for key, item in existing_object_caches.iteritems():
            self.create_object_cache(key, **item)
Esempio n. 3
0
    def __init__(self, dep_cache, obj_cache, pod):
        self._pod = pod

        self._collection_cache = collection_cache.CollectionCache()
        self._document_cache = document_cache.DocumentCache()
        self._file_cache = file_cache.FileCache()

        self._dependency_graph = dependency.DependencyGraph()
        self._dependency_graph.add_all(dep_cache)

        self._object_caches = {}
        self.create_object_cache(self.KEY_GLOBAL,
                                 write_to_file=False,
                                 can_reset=True)

        existing_object_caches = obj_cache
        for key, item in existing_object_caches.iteritems():
            self.create_object_cache(key, **item)
Esempio n. 4
0
 def setUp(self):
     dir_path = testing.create_test_pod_dir()
     self.pod = pods.Pod(dir_path, storage=storage.FileStorage)
     self.doc_cache = document_cache.DocumentCache()