How to get the size of ETS after caching?

I am using Cachex to cachex my api response but I want to know the size of the ETS once the data is cache.
Is there any way i could do know whats the size of ets once we persist this data in it?

I am unable to start anything as I am blank right now.
Hence no tried & failed attempts code.


Looking to their docs it seems you can only control its size limit in number of entries, but @OvermindDL1 is a big fan of CacheX, thus he may tell you if is possible or not :wink:

1 Like

I am able to get the table info by

  id: #Reference<0.1101184093.3508666371.167614>,
  read_concurrency: true,
  write_concurrency: true,
  compressed: false,
  memory: 40378, # Is this byte or KB?
  owner: #PID<0.589.0>,
  heir: #PID<0.588.0>,
  name: :my_cache_key,
  size: 2,
  node: :nonode@nohost,
  named_table: true,
  type: :set,
  keypos: 2,
  protection: :public

Now I am confuse about the unit of the memory.

1 Like

A quick search in Google for :ets_info will get you into the ets docs where you can find the definition for the meaning of memory:

{memory, integer() >= 0

    The number of words allocated to the table.

Yes, thanks I got that.
Also I found another command :erlang.memory(:ets) which gives the data in bytes.