aboutsummaryrefslogtreecommitdiffstats
path: root/agent/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'agent/cache.c')
-rw-r--r--agent/cache.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/agent/cache.c b/agent/cache.c
index 4b18ad30f..8f5bf9d3d 100644
--- a/agent/cache.c
+++ b/agent/cache.c
@@ -150,6 +150,35 @@ housekeeping (void)
}
+void
+agent_flush_cache (void)
+{
+ ITEM r;
+
+ if (DBG_CACHE)
+ log_debug ("agent_flush_cache\n");
+
+ for (r=thecache; r; r = r->next)
+ {
+ if (!r->lockcount && r->pw)
+ {
+ if (DBG_CACHE)
+ log_debug (" flushing `%s'\n", r->key);
+ release_data (r->pw);
+ r->pw = NULL;
+ r->accessed = 0;
+ }
+ else if (r->lockcount && r->pw)
+ {
+ if (DBG_CACHE)
+ log_debug (" marked `%s' for flushing\n", r->key);
+ r->accessed = 0;
+ r->ttl = 0;
+ }
+ }
+}
+
+
/* Store DATA of length DATALEN in the cache under KEY and mark it
with a maximum lifetime of TTL seconds. If there is already data