key-value-storenats.io

Changing NATS KV Store default TTL and allowing per-key TTL


https://github.com/nats-io/nats.js/pull/281 says that it adds support for per-message TTL in KV and JetStream. I have a couple of questions:


Solution

  • In case this questions is still relevant

    Is there a way to set a per-key TTL?

    Yes, you can. You need enable this by adding LimitMarkerTTL to kv config while creating kv bucket tho.

    Once a KV store has been created, is there a way to change its default TTL, as you can with streams?

    Yes, you can change default bucket TTL, existing keys TTL WILL be affected.