def _setCachedRFInfo(self, cache_key, path, rfinfo): from remotefilelib import addslash log.debug("_setCachedRFInfo: Adding rfinfo, cache_key %r, path %r", cache_key, path) cache = self._cachedFiles.get(cache_key) if cache is None: self._cachedFiles[cache_key] = cache = {} # Add the rfinfo to the cache cache[path] = rfinfo # Add all the child rfinfo's to the cache children = rfinfo.getChildren() for i in range(len(children)): childRFInfo = children[i] child_path = addslash(path) + childRFInfo.getFilename() if cache.has_key(child_path): # It's already cached, update the child to be the cached object log.debug( "_setCachedRFInfo: Adding new child rfinfo to cache: '%s'", child_path) children[i] = cache[child_path] else: # It's not cached, add it to the cache then log.debug( "_setCachedRFInfo: Adding new child rfinfo to cache: '%s'", child_path) cache[child_path] = childRFInfo
def _removeCachedRFInfo(self, cache_key, path, removeChildPaths): if self._cachedFiles.has_key(cache_key): cache = self._cachedFiles[cache_key] if cache.has_key(path): del cache[path] if removeChildPaths: # Remove all cached paths that are under this directory from remotefilelib import addslash dirPath = addslash(path) for keypath in cache.keys(): if keypath.startswith(dirPath): del cache[keypath]
def _setCachedRFInfo(self, cache_key, path, rfinfo): from remotefilelib import addslash log.debug("_setCachedRFInfo: Adding rfinfo to cache: '%s'", path) # Start with a new cache for this item. cache = {path: rfinfo} # Add all the child rfinfo's to the cache children = rfinfo.getChildren() for i in range(len(children)): childRFInfo = children[i] child_path = addslash(path) + childRFInfo.getFilename() if cache.has_key(child_path): # It's already cached, update the child to be the cached object log.debug("_setCachedRFInfo: Adding new child rfinfo to cache: '%s'", child_path) children[i] = cache[child_path] else: # It's not cached, add it to the cache then log.debug("_setCachedRFInfo: Adding new child rfinfo to cache: '%s'", child_path) cache[child_path] = childRFInfo self._cachedFiles[cache_key] = cache
def _setCachedRFInfo(self, cache_key, path, rfinfo): from remotefilelib import addslash log.debug("_setCachedRFInfo: Adding rfinfo, cache_key %r, path %r", cache_key, path) cache = self._cachedFiles.get(cache_key) if cache is None: self._cachedFiles[cache_key] = cache = {} # Add the rfinfo to the cache cache[path] = rfinfo # Add all the child rfinfo's to the cache children = rfinfo.getChildren() for i in range(len(children)): childRFInfo = children[i] child_path = addslash(path) + childRFInfo.getFilename() if cache.has_key(child_path): # It's already cached, update the child to be the cached object log.debug("_setCachedRFInfo: Adding new child rfinfo to cache: '%s'", child_path) children[i] = cache[child_path] else: # It's not cached, add it to the cache then log.debug("_setCachedRFInfo: Adding new child rfinfo to cache: '%s'", child_path) cache[child_path] = childRFInfo
def _setCachedRFInfo(self, cache_key, path, rfinfo): from remotefilelib import addslash log.debug("_setCachedRFInfo: Adding rfinfo to cache: '%s'", path) # Start with a new cache for this item. cache = {path: rfinfo} # Add all the child rfinfo's to the cache children = rfinfo.getChildren() for i in range(len(children)): childRFInfo = children[i] child_path = addslash(path) + childRFInfo.getFilename() if cache.has_key(child_path): # It's already cached, update the child to be the cached object log.debug( "_setCachedRFInfo: Adding new child rfinfo to cache: '%s'", child_path) children[i] = cache[child_path] else: # It's not cached, add it to the cache then log.debug( "_setCachedRFInfo: Adding new child rfinfo to cache: '%s'", child_path) cache[child_path] = childRFInfo self._cachedFiles[cache_key] = cache