Nebulex v2.0.0-rc.0 Nebulex.Adapter.Queryable behaviour View Source

Specifies the query API required from adapters.

Link to this section Summary

Callbacks

Fetches all entries from cache matching the given query.

Streams the given query.

Link to this section Callbacks

Specs

all(Nebulex.Adapter.adapter_meta(), query :: any(), Nebulex.Cache.opts()) :: [
  any()
]

Fetches all entries from cache matching the given query.

If the query is nil, it fetches all entries from cache; this is common for all adapters. However, the query could be any other value, that depends entirely on the adapter's implementation. Therefore, it is recommended to check out adapters' documentation. For instance, the built-in Nebulex.Adapters.Local adapter supports :ets.match_spec() as query.

May raise Nebulex.QueryError if query validation fails.

See Nebulex.Cache.all/2.

Link to this callback

stream(arg1, query, arg3)

View Source

Specs

Streams the given query.

It returns a stream of values.

May raise Nebulex.QueryError if query validation fails.

See Nebulex.Cache.stream/2.