FileCache * FileSystem::findFileCache(FileSystemPath *p) { List<String *> *entries = p->split(); FileCache *c = m_root; /* Root is treated special. */ if (!p->parent() && p->length() == 0) { return m_root; } /* Loop the entire path. */ for (ListIterator<String *> i(entries); i.hasCurrent(); i++) { if (!c->entries.contains(*i.current())) return ZERO; c = (FileCache *) c->entries.value(*i.current()); } /* Perform cachehit? */ if (c) { cacheHit(c); } /* Return what we got. */ return c && c->valid ? c : ZERO; }
void ProfileManager::addToCache(Profile * profile) { if(inPersistent(profile->getID())) m_profiles_persistent[profile->getID()]->merge(profile); else if(cacheHit(profile->getID())) m_profiles_cache[profile->getID()]->merge(profile); else directToCache(profile); }
Profile * ProfileManager::getProfileByID(const uint32_t id) { if(inPersistent(id)) return m_profiles_persistent[id]; if(cacheHit(id)) return m_profiles_cache[id]; //FIXME not able to get! Now this should actually fetch the info from the server, but I haven't come up with a good asynchronous idea yet. return NULL; }