Islands.Board.Cache (Islands Board Cache v0.1.17) View Source
Board Cache for the Game of Islands. Returns a random board.
Inspired by the book Functional Web Development by Lance Halvorsen.
But mostly inspired by the course Multi-Player Bingo by Mike and Nicole Clark.
Link to this section Summary
Functions
Returns the number of boards in the cache.
Returns a random board.
Persists the given board to the configured external file.
Refreshes the cache from the configured external file and resets the timer.
Link to this section Functions
Specs
board_count() :: pos_integer()
Returns the number of boards in the cache.
Specs
get_board() :: Islands.Board.t()
Returns a random board.
Examples
iex> alias Islands.Board.Cache
iex> alias Islands.Board
iex> %Board{islands: islands, misses: misses} = Cache.get_board()
iex> {map_size(islands), MapSet.size(misses)}
{5, 0}
Specs
persist_board(Islands.Board.t()) :: :ok
Persists the given board to the configured external file.
Specs
refresh() :: :refresh
Refreshes the cache from the configured external file and resets the timer.