+ * cached_getkeysigs - Gets the signatures on a key.
+ * @keyid: The key we want the signatures for.
+ *
+ * This function gets the signatures on a key. It's the same as the
+ * getkeysigs function above except we use the hash module to cache the
+ * data so if we need it again it's already loaded.
+ */
+struct ll *generic_cached_getkeysigs(struct onak_dbctx *dbctx, uint64_t keyid)
+{
+ struct stats_key *key = NULL;
+ struct stats_key *signedkey = NULL;
+ struct ll *cursig = NULL;
+ struct ll *sigs = NULL;
+ bool revoked = false;
+
+ if (keyid == 0) {
+ return NULL;
+ }
+
+ key = findinhash(keyid);
+
+ if (key == NULL || key->gotsigs == false) {
+ sigs = dbctx->getkeysigs(dbctx, keyid, &revoked);
+ if (sigs == NULL) {
+ return NULL;
+ }
+ if (key == NULL) {
+ key = createandaddtohash(keyid);
+ }
+ key->sigs = sigs;
+ key->revoked = revoked;
+ for (cursig = key->sigs; cursig != NULL;
+ cursig = cursig->next) {
+ signedkey = (struct stats_key *) cursig->object;
+ signedkey->signs = lladd(signedkey->signs, key);
+ }
+ key->gotsigs = true;
+ }
+
+ return key->sigs;
+}
+
+#ifdef NEED_UPDATEKEYS
+/**
+ * update_keys - Takes a list of public keys and updates them in the DB.
+ * @keys: The keys to update in the DB.
+ * @sendsync: Should we send a sync mail to our peers.