chiark
/
gitweb
/
~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/disorder
[disorder]
/
lib
/
cache.c
diff --git
a/lib/cache.c
b/lib/cache.c
index e0f69ef6225cff4048914529a6a9b976fa64ac33..52629de4234f6e31e72028622e4a6d6171aa17be 100644
(file)
--- a/
lib/cache.c
+++ b/
lib/cache.c
@@
-24,6
+24,7
@@
#include "hash.h"
#include "mem.h"
#include "log.h"
#include "hash.h"
#include "mem.h"
#include "log.h"
+#include "syscalls.h"
#include "cache.h"
/** @brief The global cache */
#include "cache.h"
/** @brief The global cache */
@@
-60,7
+61,7
@@
void cache_put(const struct cache_type *type,
c = xmalloc(sizeof *c);
c->type = type;
c->value = value;
c = xmalloc(sizeof *c);
c->type = type;
c->value = value;
- time(&c->birth);
+
x
time(&c->birth);
hash_add(h, key, c, HASH_INSERT_OR_REPLACE);
}
hash_add(h, key, c, HASH_INSERT_OR_REPLACE);
}
@@
-75,7
+76,7
@@
const void *cache_get(const struct cache_type *type, const char *key) {
if(h
&& (c = hash_find(h, key))
&& c->type == type
if(h
&& (c = hash_find(h, key))
&& c->type == type
- && !expired(c, time(0)))
+ && !expired(c,
x
time(0)))
return c->value;
else
return 0;
return c->value;
else
return 0;
@@
-98,7
+99,7
@@
void cache_expire(void) {
time_t now;
if(h) {
time_t now;
if(h) {
- time(&now);
+
x
time(&now);
hash_foreach(h, expiry_callback, &now);
}
}
hash_foreach(h, expiry_callback, &now);
}
}