hammer icon indicating copy to clipboard operation
hammer copied to clipboard

Allow all key types

Open tanguilp opened this issue 5 years ago • 1 comments

Hi,

One improvement idea: allowing any key type (any erlang term) for keys, and letting the backend to deal with it if unsupported. For instance, if I want to throttle an API on IP address, machine id and and user id, I might want to store it directly as a key ([{122, 12, 243,109}, "device_382719", "edward03"]) or a hash of it (:erlang.phash2([{122, 12, 243,109}, "device_382719", "edward03"]) which returns an integer).

ETS and Mnesia could store both forms as-is (not sure about the performances when storing the non-hashed key though, guess it depends on the length). As of today, the mandatory conversion to a binary might unnecessarily degrade performance.

tanguilp avatar Nov 10 '18 16:11 tanguilp

That's a cool suggestion, I'll see if it's feasible :+1:

JuneKelly avatar Dec 05 '18 17:12 JuneKelly

@tanguilp do you still need this feature?

epinault avatar Aug 31 '23 22:08 epinault

Not really that was just a suggestion and I’m no longer sure it’sa good one 🙂

tanguilp avatar Sep 01 '23 07:09 tanguilp