mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 02:25:34 -04:00
Added RecognTags.
- items are described in serialiser. - util functions in util/rsrecogn.cc are used to manipulate it. - these are attached to GxsIds, with new interface fns. - Associated Signing Code is in a separate program. Other Tweaks. - Added RsMemCache::erase() - Added RsTlvStringSetRef - Fix for rsturtleitem (already added to trunk). - Formatting and debugging. Status: There is a bug in RsGenExchange::updateGroup which prevents full testing, The basic generation, parsing and validation functions have been tested and are ok. The processing as part of p3IdService still needs to be fully debugged. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs_finale@6854 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
19d7faa572
commit
fc58861447
19 changed files with 2645 additions and 101 deletions
|
@ -65,6 +65,7 @@ template<class Key, class Value> class RsMemCache
|
|||
bool fetch(const Key &key, Value &data);
|
||||
Value &ref(const Key &key); // like map[] installs empty one if non-existent.
|
||||
bool store(const Key &key, const Value &data);
|
||||
bool erase(const Key &key); // clean up cache.
|
||||
|
||||
bool resize(); // should be called periodically to cleanup old entries.
|
||||
|
||||
|
@ -169,6 +170,47 @@ template<class Key, class Value> bool RsMemCache<Key, Value>::fetch(const Key &k
|
|||
}
|
||||
|
||||
|
||||
template<class Key, class Value> bool RsMemCache<Key, Value>::erase(const Key &key)
|
||||
{
|
||||
#ifdef DEBUG_RSMEMCACHE
|
||||
std::cerr << "RsMemCache::erase()";
|
||||
std::cerr << std::endl;
|
||||
printStats(std::cerr);
|
||||
#endif // DEBUG_RSMEMCACHE
|
||||
|
||||
typename std::map<Key, cache_data>::iterator it;
|
||||
it = mDataMap.find(key);
|
||||
if (it == mDataMap.end())
|
||||
{
|
||||
#ifdef DEBUG_RSMEMCACHE
|
||||
std::cerr << "RsMemCache::erase(" << key << ") false";
|
||||
std::cerr << std::endl;
|
||||
#endif // DEBUG_RSMEMCACHE
|
||||
|
||||
mStats_accessmiss++;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_RSMEMCACHE
|
||||
std::cerr << "RsMemCache::erase(" << key << ") OK";
|
||||
std::cerr << std::endl;
|
||||
#endif // DEBUG_RSMEMCACHE
|
||||
|
||||
|
||||
/* get timestamps */
|
||||
time_t old_ts = it->second.ts;
|
||||
time_t new_ts = 0;
|
||||
|
||||
// remove from lru.
|
||||
mDataMap.erase(it);
|
||||
update_lrumap(key, old_ts, new_ts);
|
||||
|
||||
mStats_access++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class Key, class Value> Value &RsMemCache<Key, Value>::ref(const Key &key)
|
||||
{
|
||||
#ifdef DEBUG_RSMEMCACHE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue