Added request am29544 (nvault_touch)

This commit is contained in:
David Anderson
2006-08-20 21:23:38 +00:00
parent ea262171db
commit deefc504e1
6 changed files with 72 additions and 13 deletions

View File

@ -8,6 +8,12 @@
#define _snprintf snprintf
#endif
/**
* :TODO: This beast calls strcpy()/new() way too much by creating new strings on the stack.
* That's easily remedied and it should be fixed?
* ---bail
*/
template <>
int HashFunction<String>(const String & k)
{
@ -284,6 +290,18 @@ size_t NVault::Prune(time_t start, time_t end)
return m_Hash.Prune(start, end);
}
void NVault::Touch(const char *key, time_t stamp)
{
String sKey(key);
if (!m_Hash.Exists(sKey))
{
SetValue(key, "", time(NULL));
}
m_Hash.Touch(key, stamp);
}
bool NVault::GetValue(const char *key, time_t &stamp, char buffer[], size_t len)
{
String sKey(key);