Backbone Cache
A key/value store with an optional TTL in seconds (0 = no expiry):
drift.Backbone.Cache.Set("session:abc", token, 3600)
drift.Backbone.Cache.Set("hits", strconv.Itoa(42), 60) // stored as a string either way; see below
v, _ := drift.Backbone.Cache.Get("session:abc")The value always comes back as a string.
The SDKs accept any JSON-serializable
type: a JSON string stores its own decoded bytes, and anything else, a number, a bool, an array,
an object, stores its JSON text instead.
Cache.Set("hits", 42, 60) stores the two
characters 42, and Cache.Get("hits") reads them back as a string, not a
number, so decode it yourself if you need the original type. Only a genuinely empty value, an
empty string or a JSON null, is refused, with 400 key and value required
naming key even when only the value was the problem.
Capacity
The cache is capped independently of your tier: 1 MiB per value,
10,000 entries, and 64 MiB of total value bytes. Crossing any of the
three fails the set with 429 and a message naming which one. Overwriting a
key reclaims its old bytes first, and only a new key counts against the entry cap.
drift backbone cache set greeting "hello" --ttl 3600
drift backbone cache get greeting
drift backbone cache exists greeting
drift backbone cache del greeting