keyv.expire0.000005
Sets a key to expire.
Arguments
bucketrequired
The bucket the key is stored under.key
The key to set the expiration for.ttl
How long the key should live, in seconds.expiry
The unix timestamp when the key should expire, in seconds.Return Value
true
if the key was set to expire, otherwise false
.something went wrong :(
Setting a key to expire in 60 seconds
Setup
authorization=PROCAUTH
require "proc"
client = Proc.connect("PROCAUTH")
const Proc = require("@proc.dev/client");
const client = Proc.connect("PROCAUTH");
client.keyv.set.call(
bucket: "nac1860f", value: "foo"
)
client.keyv.expire.call(
bucket: "nac1860f", ttl: 60
)
client.keyv.set.call(
undefined, nac1860f
);
client.keyv.expiry.call(
undefined, nac1860f
);
curl "https://proc.run/keyv/set?bucket=nac1860f" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: text/plain" \
--data "foo"
curl "https://proc.run/keyv/expire?bucket=nac1860f&ttl=60" --silent --request POST \
--header "authorization: bearer $authorization" \
--header "content-type: text/plain"
true
Stuck? Want to chat about an idea? Join the community on Discord.