keyv.count0.000005
Counts keys.
Arguments
bucketrequired
The bucket the keys are stored under.prefix
Restricts the count to keys that match the given prefix.Return Value
The number of keys in the bucket.something went wrong :(
Counting keys in a bucket
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: "v166773c", value: "foo"
)
client.keyv.count.call(
bucket: "v166773c"
)
client.keyv.set.call(
undefined, v166773c
);
client.keyv.count.call(
undefined, v166773c
);
curl "https://proc.run/keyv/set?bucket=v166773c" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: text/plain" \
--data "foo"
curl "https://proc.run/keyv/count?bucket=v166773c" --silent --request POST \
--header "authorization: bearer $authorization" \
--header "content-type: text/plain"
1
If prefix
is passed, the count is constrained to keys that match the given prefix.
something went wrong :(
Counting keys that match a prefix
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: "m53ccc4d", value: "foo"
)
client.keyv.set.call(
bucket: "m53ccc4d", value: "bar"
)
client.keyv.count.call(
bucket: "m53ccc4d", prefix: "a"
)
client.keyv.set.call(
undefined, m53ccc4d
);
client.keyv.set.call(
undefined, m53ccc4d
);
client.keyv.count.call(
undefined, m53ccc4d
);
curl "https://proc.run/keyv/set?bucket=m53ccc4d" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: text/plain" \
--data "foo"
curl "https://proc.run/keyv/set?bucket=m53ccc4d" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: text/plain" \
--data "bar"
curl "https://proc.run/keyv/count?bucket=m53ccc4d&prefix=a" --silent --request POST \
--header "authorization: bearer $authorization" \
--header "content-type: text/plain"
1
Stuck? Want to chat about an idea? Join the community on Discord.