Skip to content

Commit

Permalink
Update test docs to show new options
Browse files Browse the repository at this point in the history
  • Loading branch information
whitfin committed Sep 23, 2024
1 parent ae0edae commit d2e7cb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/cachex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1129,10 +1129,13 @@ defmodule Cachex do
iex> Cachex.put(:my_cache, "key1", "value1")
iex> Cachex.put(:my_cache, "key2", "value2")
iex> Cachex.put(:my_cache, "key3", "value3")
iex> Cachex.put(:my_cache, "key3", "value3", expire: 1)
iex> Cachex.size(:my_cache)
{ :ok, 3 }
iex> Cachex.size(:my_cache, expired: false)
{ :ok, 2 }
"""
@spec size(Cachex.t(), Keyword.t()) :: {status, number}
def size(cache, options \\ []) when is_list(options),
Expand Down
3 changes: 1 addition & 2 deletions test/cachex_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
defmodule CachexTest do
use Cachex.Test.Case
import Integer

# Ensures that we're able to start a cache and link it to the current process.
# We verify the link by spawning a cache from inside another thread and making
Expand Down Expand Up @@ -163,7 +162,7 @@ defmodule CachexTest do
|> Keyword.drop([:child_spec, :init, :start, :start_link])

# it has to always be even (one signature creates ! versions)
assert(is_even(length(definitions)))
assert(rem(length(definitions), 2) == 0)

# verify the size to cause errors on addition/removal
assert(length(definitions) == 146)
Expand Down

0 comments on commit d2e7cb6

Please sign in to comment.