1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Caching do
6 @callback get!(Cachex.cache(), any()) :: any()
7 @callback get(Cachex.cache(), any()) :: {atom(), any()}
8 @callback put(Cachex.cache(), any(), any(), Keyword.t()) :: {Cachex.status(), boolean()}
9 @callback put(Cachex.cache(), any(), any()) :: {Cachex.status(), boolean()}
10 @callback fetch!(Cachex.cache(), any(), function() | nil) :: any()
11 @callback fetch(Cachex.cache(), any(), function() | nil) ::
12 {atom(), any()} | {atom(), any(), any()}
13 # @callback del(Cachex.cache(), any(), Keyword.t()) :: {Cachex.status(), boolean()}
14 @callback del(Cachex.cache(), any()) :: {Cachex.status(), boolean()}
15 @callback stream!(Cachex.cache(), any()) :: Enumerable.t()
16 @callback expire_at(Cachex.cache(), binary(), number()) :: {Cachex.status(), boolean()}
17 @callback expire(Cachex.cache(), binary(), number()) :: {Cachex.status(), boolean()}
18 @callback exists?(Cachex.cache(), any()) :: {Cachex.status(), boolean()}
19 @callback execute!(Cachex.cache(), function()) :: any()
20 @callback get_and_update(Cachex.cache(), any(), function()) ::
21 {:commit | :ignore, any()}