Islands Board Cache v0.1.3 Islands.Board.Cache View Source

Board Cache for the Game of Islands. Returns a random board.

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 source

Refreshes the cache from the configured external source and resets the timer

Link to this section Functions

Link to this function

board_count() View Source
board_count() :: pos_integer()

Returns the number of boards in the cache.

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}
Link to this function

persist_board(board) View Source
persist_board(Islands.Board.t()) :: :ok

Persists the given board to the configured external source.

Link to this function

refresh() View Source
refresh() :: :refresh

Refreshes the cache from the configured external source and resets the timer.