Questions tagged [ets]

ets: Erlang Term Storage. It is a set of Erlang built in functions (BIF) that aims to provide a way to store in memory a large amount of data with constant access time. The data is stored as {Key,Value} tuples where both Key an Value may be any Erlang terms. It can be configured as ordered set, set, bag or duplicate_bag.

159 questions
5
votes
1 answer

How to create complex queries with elixir ets

I have cached a bunch of postcode and lat-long values using erlangs ets functionality. Picture the following... iex()> :ets.new(:postcode_cache, [:named_table]) :postcode_cache iex()> :ets.insert(:postcode_cache, [{"OX495NU",…
RobStallion
  • 1,624
  • 1
  • 15
  • 28
5
votes
2 answers

Using ets:foldl as a poor man's forEach on every record

Short version: is it safe to use ets:foldl to delete every ETS record as one is iterating through them? Suppose an ETS table is accumulating information and now it's time to process it all. A record is read from the table, used in some way, then…
JasonSmith
  • 72,674
  • 22
  • 123
  • 149
5
votes
1 answer

Distributed Caching in Elixir

I am writing an Elixir app that requires a registry to store the mapping of which pid belongs to which user. I will have an GenServer per user in the app that will be supervised. I have the basic example working with one node using ETS but with 2+…
ed1t
  • 8,719
  • 17
  • 67
  • 110
5
votes
2 answers

which is the best criteria for choosing between ets() and auto.arima() functions in R?

I am using ets() and auto.arima() functions from forecast package to predict future values in R. Which criteria should be used to choose the best model between these two? Following is the accuracy output from ets (data.ets) and auto.arima…
priyaj
  • 51
  • 1
  • 5
5
votes
4 answers

Share ETS table with two processes?

I create ETS table in one process and I want use it in another process. How I "open" ETS table in second process? Could not find good function in man pages.
Lethi
  • 1,167
  • 1
  • 10
  • 16
5
votes
2 answers

What's the best erlang approach to being able to identify a processes identity from its process id?

When I'm debugging, I'm usually looking at about 5000 processes, each of which could be one of about 100 gen_servers, fsms, etc. If I want to know WHAT an erlang process is, I can do: process_info(pid(0,1,0), initial_call). And get a result…
Sniggerfardimungus
  • 11,583
  • 10
  • 52
  • 97
4
votes
1 answer

Filtering erlang ets tables without using guard clauses

In elixir, I would like to be able to filter an ets table using a function. I currently have a simple ets table example in the iex shell... iex> :ets.new(:nums, [:named_table]) :nums iex> :ets.insert :nums, [{1}, {2}, {3}, {4}, {5}] true fun =…
RobStallion
  • 1,624
  • 1
  • 15
  • 28
4
votes
1 answer

Elixir process taking up too much memory

I am reading postcodes from a csv file, taking that data and caching it with ets. The postcode file is quite large (95MB) as it contains about 1.8 million entries. I am only caching the postcodes that are needed for look ups at the moment (about…
RobStallion
  • 1,624
  • 1
  • 15
  • 28
4
votes
3 answers

Mostly read only use of DETS

So I have been using ETS - works great. However, I use it as a cache of route data - which I load when the module loads, and save when a change is made (it is read far more than written). I was thinking that DETS would make things much cleaner - I…
Michael Neale
  • 19,248
  • 19
  • 77
  • 109
4
votes
1 answer

Elixir ETS key pattern matching

I am using ETS to cached a database schema from postegress using ecto here are those examples: table = :ets.new(:cache_name,[:set, :protected]) and include those…
Luis Louis
  • 644
  • 6
  • 21
4
votes
1 answer

ets: Error in ets(timeseries, model = "MAM") : Nonseasonal data

I'm trying to create a forecast using an exponential smoothing method, but get the error "nonseasonal data". This is clearly not true - see code below. Why am I getting this error? Should I use a different function (it should be able to perform…
r.user.05apr
  • 5,356
  • 3
  • 22
  • 39
4
votes
1 answer

How to call :ets.fun2ms in elixir?

Is it possible? if so, how? The following code is executed in an IEX. However, the compiled code generates a runtime error. :ets.fun2ms(fn({a,b}) -> a and b end) The error comes out like this: I want to know how to properly call. ** (exit) exited…
aposto
  • 566
  • 5
  • 14
4
votes
1 answer

Erlang ETS insert/2 error

I am trying to create a simple Erlang process with the access to ETS module. My source code includes: Process creation: start_message_channel() -> Table = ets:new(messages, [ordered_set, named_table]), Channel = spawn(?MODULE, channel,…
Daumantas Versockas
  • 797
  • 1
  • 10
  • 29
4
votes
3 answers

Erlang ets remove / filter element

I use elang ets table as a simple cache. I want to use a process to scan the table and remove expired elements (multiple). with ets:foldl expire_table_example() -> Tab = ets:new(ets_tab, [named_table, set]), ets:insert(Tab, [{a, 1}, {b, 2}, {c,…
user3644708
  • 2,466
  • 2
  • 16
  • 32
4
votes
2 answers

Erlang - Comparing between ETS tables

We would like to know how to find mutual elements between two ets tables efficiently, we tried ETS and QLC modules but couldn't find out how to do it, we are using ets on [bag] option which means that we have several values for the same key. We are…
FlipFlop
  • 41
  • 3
1
2
3
10 11