template<typename T>
class StupidCacheKV
{
private:
map<string, T> cache;
mutable sox::mutex StupidCacheMutex;
public:
void set(const string& key, const T & value)
{
sox::scope_lock lock(StupidCacheMutex);
cache[key] = value;
};
T get(const string& key)
{
sox::scope_lock lock(StupidCacheMutex);
return cache[key];
};
bool exist(const string& key) const
{
sox::scope_lock lock(StupidCacheMutex);
return (cache.find(key) != cache.end());
}
uint32_t size() const
{
sox::scope_lock lock(StupidCacheMutex);
return cache.size();
}
};
class StupidCacheKV
{
private:
map<string, T> cache;
mutable sox::mutex StupidCacheMutex;
public:
void set(const string& key, const T & value)
{
sox::scope_lock lock(StupidCacheMutex);
cache[key] = value;
};
T get(const string& key)
{
sox::scope_lock lock(StupidCacheMutex);
return cache[key];
};
bool exist(const string& key) const
{
sox::scope_lock lock(StupidCacheMutex);
return (cache.find(key) != cache.end());
}
uint32_t size() const
{
sox::scope_lock lock(StupidCacheMutex);
return cache.size();
}
};