@@ -259,8 +259,7 @@ defmodule Scenic.Cache.Base do
259
259
* `scope` - Optional scope to track the lifetime of this asset against. Can be `:global`
260
260
but is usually nil, which defaults to the pid of the calling process.
261
261
262
- Returns:
263
- {:ok, hash}
262
+ Returns: `{:ok, hash}`
264
263
"""
265
264
@ spec put (
266
265
hash :: Scenic.Cache.Base . hash ( ) ,
@@ -286,8 +285,7 @@ defmodule Scenic.Cache.Base do
286
285
* `scope` - Optional scope to track the lifetime of this asset against. Can be `:global`
287
286
but is usually nil, which defaults to the pid of the calling process.
288
287
289
- Returns:
290
- {:ok, hash}
288
+ Returns: `{:ok, hash}`
291
289
"""
292
290
@ spec put_new (
293
291
hash :: Scenic.Cache.Base . hash ( ) ,
@@ -578,46 +576,6 @@ defmodule Scenic.Cache.Base do
578
576
GenServer . call ( service , { :put , normalize_scope ( scope ) , key , data } )
579
577
end
580
578
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
-
621
579
# --------------------------------------------------------
622
580
@ doc """
623
581
Add a scope to an existing asset in the cache.
@@ -662,7 +620,7 @@ defmodule Scenic.Cache.Base do
662
620
processes a chance to claim a scope before it is unloaded.
663
621
"""
664
622
665
- # returns :ok
623
+ # returns ` :ok`
666
624
@ spec release (
667
625
service :: atom ,
668
626
hash :: Scenic.Cache.Base . hash ( ) ,
@@ -701,9 +659,11 @@ defmodule Scenic.Cache.Base do
701
659
Pass in the service, hash, and a scope.
702
660
703
661
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
+ ```
707
667
"""
708
668
@ spec status (
709
669
service :: atom ,
@@ -741,7 +701,7 @@ defmodule Scenic.Cache.Base do
741
701
742
702
Pass in the service and a hash.
743
703
744
- returns true or false.
704
+ returns ` true` or ` false` .
745
705
"""
746
706
@ spec member? (
747
707
service :: atom ,
@@ -756,7 +716,7 @@ defmodule Scenic.Cache.Base do
756
716
757
717
Pass in the service, hash, and scope.
758
718
759
- returns true or false.
719
+ returns ` true` or ` false` .
760
720
"""
761
721
@ spec claimed? (
762
722
service :: atom ,
0 commit comments