Skip to content

Commit 084721a

Browse files
committed
fix doc compile warning and improve return type docs
1 parent 081d3ca commit 084721a

File tree

1 file changed

+10
-50
lines changed

1 file changed

+10
-50
lines changed

lib/scenic/cache/base.ex

Lines changed: 10 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ defmodule Scenic.Cache.Base do
259259
* `scope` - Optional scope to track the lifetime of this asset against. Can be `:global`
260260
but is usually nil, which defaults to the pid of the calling process.
261261
262-
Returns:
263-
{:ok, hash}
262+
Returns: `{:ok, hash}`
264263
"""
265264
@spec put(
266265
hash :: Scenic.Cache.Base.hash(),
@@ -286,8 +285,7 @@ defmodule Scenic.Cache.Base do
286285
* `scope` - Optional scope to track the lifetime of this asset against. Can be `:global`
287286
but is usually nil, which defaults to the pid of the calling process.
288287
289-
Returns:
290-
{:ok, hash}
288+
Returns: `{:ok, hash}`
291289
"""
292290
@spec put_new(
293291
hash :: Scenic.Cache.Base.hash(),
@@ -578,46 +576,6 @@ defmodule Scenic.Cache.Base do
578576
GenServer.call(service, {:put, normalize_scope(scope), key, data})
579577
end
580578

581-
# # --------------------------------------------------------
582-
# @doc """
583-
# Insert an item into the Cache. If it is already in the cache, then it
584-
# does nothing and returns {:ok, hash}
585-
586-
# Parameters:
587-
# * `key` - term to use as the retrieval key. Typically a hash of the data itself.
588-
# * `data` - term to use as the stored data
589-
# * `scope` - Optional scope to track the lifetime of this asset against. Can be `:global`
590-
# but is usually nil, which defaults to the pid of the calling process.
591-
592-
# ## Examples
593-
# iex> Scenic.Cache.get("test_key")
594-
# nil
595-
596-
# iex> :ets.insert(:scenic_cache_key_table, {"test_key", 1, :test_data})
597-
# ...> true
598-
# ...> Scenic.Cache.get("test_key")
599-
# :test_data
600-
# """
601-
# @spec put_new(
602-
# service :: atom,
603-
# hash :: Scenic.Cache.Base.hash(),
604-
# data :: term(),
605-
# scope :: :global | nil | GenServer.server()
606-
# ) :: term()
607-
608-
# def put_new(service, hash, data, scope \\ nil)
609-
# when service != nil and (is_atom(service) or is_pid(service)) do
610-
# scope = normalize_scope(scope)
611-
612-
# case :ets.member(service, hash) do
613-
# true ->
614-
# {:ok, hash}
615-
616-
# false ->
617-
# GenServer.call(service, {:put_new, scope, hash, data})
618-
# end
619-
# end
620-
621579
# --------------------------------------------------------
622580
@doc """
623581
Add a scope to an existing asset in the cache.
@@ -662,7 +620,7 @@ defmodule Scenic.Cache.Base do
662620
processes a chance to claim a scope before it is unloaded.
663621
"""
664622

665-
# returns :ok
623+
# returns `:ok`
666624
@spec release(
667625
service :: atom,
668626
hash :: Scenic.Cache.Base.hash(),
@@ -701,9 +659,11 @@ defmodule Scenic.Cache.Base do
701659
Pass in the service, hash, and a scope.
702660
703661
returns one of:
704-
{:ok, hash} # it is claimed by the given scope
705-
{:ok, :global} # it is NOT claimed by the given scope, but is :global
706-
{:error, :not_found} # it is not in the cache at all
662+
```elixir
663+
{:ok, hash} # it is claimed by the given scope
664+
{:ok, :global} # it is NOT claimed by the given scope, but is :global
665+
{:error, :not_found} # it is not in the cache at all
666+
```
707667
"""
708668
@spec status(
709669
service :: atom,
@@ -741,7 +701,7 @@ defmodule Scenic.Cache.Base do
741701
742702
Pass in the service and a hash.
743703
744-
returns true or false.
704+
returns `true` or `false`.
745705
"""
746706
@spec member?(
747707
service :: atom,
@@ -756,7 +716,7 @@ defmodule Scenic.Cache.Base do
756716
757717
Pass in the service, hash, and scope.
758718
759-
returns true or false.
719+
returns `true` or `false`.
760720
"""
761721
@spec claimed?(
762722
service :: atom,

0 commit comments

Comments
 (0)