[Q:API] whence select_by_key?

Kong plugin development guide likes to refer to Key-Auth plugin as a example. Key-Auth uses a method “select_by_key” that afaict is used to select an entity by something other than the primary key (specifically field “key” v. “id”). The method is also included in doc code example: https://docs.konghq.com/1.5.x/plugin-development/entities-cache/. Now, I want to be able to likewise lookup an entity by an alternate candidate key on my own custom entity, but so far total fail on doings so, and reading the kong src has so far not helped out. See code snip and error below. The only work-around seems to be using text (custom_key) as custom entity’s primary key (instead of id:uuid). Q: is it possible to select custom entity by non-primary candidate key, and if so how?

NOTE: this on kong 1.5.1

tia!

~A

local custom_entity, err = kong.db.custom_entity:select_by_key(custom_key)

failed to get from node cache: callback threw an error: …/lua/5.1/kong/plugins/custom_plugin/access.lua:31: attempt to call method ‘select_by_key’ (a nil value)

Hello, have you solved this problem? I meet it too. What the select_by_key means?