From 9c136dacdf790fdfe30d1c48ad9b03add206bf73 Mon Sep 17 00:00:00 2001 From: default Date: Mon, 28 Nov 2022 08:34:19 +0100 Subject: [PATCH] New function object_user_cache_in(). --- data.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/data.c b/data.c index b6fdc7a..b3f124e 100644 --- a/data.c +++ b/data.c @@ -631,6 +631,16 @@ int object_user_cache_del(snac *snac, const char *id, const char *cachedir) } +int object_user_cache_in(snac *snac, const char *id, const char *cachedir) +/* checks if an object is stored in a cache */ +{ + xs *md5 = xs_md5_hex(id, strlen(id)); + xs *cfn = xs_fmt("%s/%s/%s.json", snac->basedir, cachedir, md5); + + return !!(mtime(cfn) != 0.0); +} + + /** specialized functions **/ d_char *_follower_fn(snac *snac, char *actor)