Exqlite.Queries (exqlite v0.3.3) View Source

The interface to manage cached prepared queries.

Link to this section Summary

Functions

Clears all of the cached prepared statements.

Completely delete the cache.

Gets an existing prepared query if it exists. Otherwise nil is returned.

Constructs a new prepared query cache with the specified limit. The cache uses a least recently used caching mechanism.

Link to this section Types

Specs

reason() :: String.t() | atom()

Specs

t() :: %Exqlite.Queries{
  limit: integer(),
  queries: ETS.Set.t(),
  timestamps: ETS.Set.t()
}

Link to this section Functions

Specs

clear(t()) :: {:ok, t()}

Clears all of the cached prepared statements.

Specs

delete(t(), Exqlite.Query.t()) :: {:ok, t()}
delete(t(), Exqlite.Query.t()) :: {:ok, t()}
delete(t(), Exqlite.Query.t()) :: {:ok, t()} | {:error, reason()}

Specs

destroy(nil) :: :ok
destroy(t()) :: :ok

Completely delete the cache.

Specs

get(t(), Exqlite.Query.t()) :: {:ok, nil}
get(t(), Exqlite.Query.t()) :: {:ok, nil}
get(t(), Exqlite.Query.t()) ::
  {:ok, Exqlite.Query.t() | nil} | {:error, reason()}

Gets an existing prepared query if it exists. Otherwise nil is returned.

Specs

new(atom()) :: t()

Constructs a new prepared query cache with the specified limit. The cache uses a least recently used caching mechanism.

Specs

put(t(), Exqlite.Query.t()) :: {:ok, t()}
put(t(), Exqlite.Query.t()) :: {:ok, t()}
put(t(), Exqlite.Query.t()) :: {:ok, t()}
put(t(), Exqlite.Query.t()) :: {:ok, t()} | {:error, reason()}

Specs

size(t()) :: integer()