how to get latest zed token with least
# spicedb
u
how to get latest zed token with least amount of computation on the spicedb end? im just trying to cache latest token on the initialisation of my service im going with resource lookup with full_consistency and looking up non existant object type, if theres a better way please do suggest! ⚡
v
that works. Another approach we typically see used is issuing
ReadSchema
. Depending on the size of your schema, doing
ReadRelationships
with the most specific
ResourceFilter
possible is possibly the most efficient way
u
will check it out, thanks!
is it cheaper to cause an error and filter for non existant resource type
or should I at least specify proper type, and then use non existant resource id?
v
I dont know the execution flow by heart, but chances are you may be able to spare a query or two if it fails with an invalid type. The best way to validate this is to look into the OpenTelemetry traces. We've enriched the traces with SQL queries for postgres and spanner, so you should be able to see the diff in roundtrips to the DB
if you want to play around with it, we have an example that sets a tracing stack for you: https://github.com/authzed/examples/tree/main/tracing
23 Views