From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [RFC datacenter-manager 0/4] add generic, per-remote (and global) cache for remote API responses
Date: Fri, 8 May 2026 17:03:26 +0200 [thread overview]
Message-ID: <20260508150330.363622-1-l.wagner@proxmox.com> (raw)
The main intention is to avoid a sprawl of different caching approaches by
establishing a simple, easy to use cache implementation that can be used to
persistently cache API responses from remotes (and derived aggregations).
Open questions:
- is the per-namespace lock too coarse? Should we rather lock
per key? Anyways, one should not hold the lock during longer periods of time
(e.g. when doing API requests), so the namespace-level lock seemed fine to me.
A per-namespace (so, per-remote) lock is nicer when one wants to update several
keys in one go.
- Base directory for cache, currently it is
/var/cache/proxmox-datacenter-manager/cache
But this seems both redundant and generic to me, so maybe
'api-cache'?
- Went with a max_age param on `get` instead of a `set` with an expiry time,
I think it's quite common to have cache readers with different requirements
to value freshness, so this might be a better fit.
Also, we use the max-age mechanism in the API already, so this
is a seamless fit then. Does this make sense? Or this we rather have
redis-style `set` with expiry time/TTL?
The `namespaced_cache` module is pretty generic and can be moved to proxmox.git
(maybe in proxmox-shared-cache) once it has sufficiently stabilized.
proxmox-datacenter-manager:
Lukas Wagner (4):
add persistent, generic, namespaced key-value cache implementation
add pdm_cache cache as a specialized wrapper around the namespaced
cache
api: resources: subscriptions: switch over to pdm_cache
remote-updates: switch over to pdm_cache
Cargo.toml | 1 +
server/Cargo.toml | 2 +
server/src/api/resources.rs | 82 ++---
.../bin/proxmox-datacenter-privileged-api.rs | 7 +
server/src/lib.rs | 2 +
server/src/namespaced_cache.rs | 324 ++++++++++++++++++
server/src/pdm_cache.rs | 69 ++++
server/src/remote_updates.rs | 52 +--
8 files changed, 452 insertions(+), 87 deletions(-)
create mode 100644 server/src/namespaced_cache.rs
create mode 100644 server/src/pdm_cache.rs
Summary over all repositories:
8 files changed, 452 insertions(+), 87 deletions(-)
--
Generated by murpp 0.12.0
next reply other threads:[~2026-05-08 15:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 15:03 Lukas Wagner [this message]
2026-05-08 15:03 ` [PATCH datacenter-manager 1/4] add persistent, generic, namespaced key-value cache implementation Lukas Wagner
2026-05-08 15:03 ` [PATCH datacenter-manager 2/4] add pdm_cache cache as a specialized wrapper around the namespaced cache Lukas Wagner
2026-05-08 15:03 ` [PATCH datacenter-manager 3/4] api: resources: subscriptions: switch over to pdm_cache Lukas Wagner
2026-05-08 15:03 ` [PATCH datacenter-manager 4/4] remote-updates: " Lukas Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260508150330.363622-1-l.wagner@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox