View Source Momento.CacheClient (Momento Elixir SDK v0.6.6)
Client to perform operations against a Momento cache.
A client is created by supplying a configuration, a credential provider, and a default time-to-live:
config = Momento.Configurations.Laptop.latest()
credential_provider = Momento.Auth.CredentialProvider.from_env_var!("MOMENTO_AUTH_TOKEN")
default_ttl_seconds = 60.0
client = CacheClient.create!(config, credential_provider, default_ttl_seconds)
The resulting struct maintains the connection and can be given to any of the CacheClient functions to make calls to Momento:
iex> Momento.CacheClient.set(client, "cache", "key", "value")
{:ok, %Momento.Responses.Set.Ok{}}
Link to this section Summary
Types
Contains all state necessary to connect to the Momento cache, including its configuration and connections. Functions that interact with a cache require it as the first argument.
Functions
Create a new CacheClient instance.
Create a new CacheClient instance.
Create a cache if it does not exist.
Delete a value from the cache.
Delete a cache and all items stored in it.
Get a value from a cache.
List all caches.
Set a value in a cache. Replaces the existing value if one is present.
Fetch the values and scores from a sorted set by rank. The returned values are ordered by their scores.
Fetch the values and scores from a sorted set by score. The returned values are ordered by their scores.
Get the rank of a value in a sorted set.
Get the score of a value in a sorted set.
Get the scores of the given values in a sorted set.
Increments the score of a value in a sorted set. Adds the value if it is not present.
Add a value and score to a sorted set. Replaces the existing score if the value is already present.
Add the given values and scores to a sorted set. Replaces the existing score for any value already present.
Remove an element from a sorted set.
Remove multiple elements from a sorted set.
Link to this section Types
@opaque t()
Contains all state necessary to connect to the Momento cache, including its configuration and connections. Functions that interact with a cache require it as the first argument.
Link to this section Functions
@spec create( config :: Momento.Config.Configuration.t(), credential_provider :: Momento.Auth.CredentialProvider.t(), default_ttl_seconds :: number() ) :: {:ok, t()} | {:error, any()}
Create a new CacheClient instance.
parameters
Parameters
config
: A%Momento.Config.Configuration{}
containing all tunable client settings.credential_provider
: A%Momento.Auth.CredentialProvider{}
representing the credentials to connect to the server.default_ttl_seconds
: A number representing the time in seconds that a value added to the cache will persist. CacheClient methods that write to a cache can override this value.
raises
Raises
- An error if the client cannot connect to momento.
returns
Returns
{:ok, %Momento.CacheClient{}}
on a successful client creation.{:error, any()}
if an error occurs.
@spec create!( config :: Momento.Config.Configuration.t(), credential_provider :: Momento.Auth.CredentialProvider.t(), default_ttl_seconds :: number() ) :: t()
Create a new CacheClient instance.
parameters
Parameters
config
: A%Momento.Config.Configuration{}
containing all tunable client settings.credential_provider
: A%Momento.Auth.CredentialProvider{}
representing the credentials to connect to the server.default_ttl_seconds
: A number representing the time in seconds that a value added to the cache will persist. CacheClient methods that write to a cache can override this value.
raises
Raises
- An error if the client cannot connect to momento.
returns
Returns
- A
%Momento.CacheClient{}
struct representing the connected client.
@spec create_cache( client :: t(), cache_name :: String.t() ) :: Momento.Responses.CreateCache.t()
Create a cache if it does not exist.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache to create. Must be a string.
returns
Returns
{:ok, %Momento.Responses.CreateCache.Ok{}}
on a successful create.:already_exists
if a cache with the specified name already exists.{:error, error}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.create_cache(client, "cache")
{:ok, %Momento.Responses.CreateCache.Ok{}}
iex> Momento.CacheClient.create_cache(client, "cache")
:already_exists
@spec delete(client :: t(), cache_name :: String.t(), key :: binary()) :: Momento.Responses.Delete.t()
Delete a value from the cache.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache to delete the value in. Must be a string.key
: The key to delete. Must be a binary.
returns
Returns
{:ok, %Momento.Responses.Delete.Ok{}}
on a successful deletion.{:error, error}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.set(client, "cache", "key", "value")
{:ok, %Momento.Responses.Set.Ok{}}
iex> Momento.CacheClient.delete(client, "cache", "key")
{:ok, %Momento.Responses.Delete.Ok{}}
@spec delete_cache( client :: t(), cache_name :: String.t() ) :: Momento.Responses.DeleteCache.t()
Delete a cache and all items stored in it.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache to delete. Must be a string.
returns
Returns
{:ok, %Momento.Responses.DeleteCache.Ok{}}
on a successful delete.{:error, error}
if an error occurs, or when deleting a cache that doesn't exist.
examples
Examples
iex> Momento.CacheClient.delete_cache(client, "cache")
{:ok, %Momento.Responses.DeleteCache.Ok{}}
@spec get(client :: t(), cache_name :: String.t(), key :: binary()) :: Momento.Responses.Get.t()
Get a value from a cache.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache to fetch the value from. Must be a string.key
: The key of the value to fetch. Must be a binary.
returns
Returns
{:ok, %Momento.Responses.Get.Hit{}}
if the key exists. It contains:value: binary()
:miss
if the key does not exist.{:error, error}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.set(client, "cache", "key", "value")
{:ok, %Momento.Responses.Set.Ok{}}
iex> Momento.CacheClient.get(client, "cache", "key")
{:ok, %Momento.Responses.Get.Hit{value: "value"}}
iex> Momento.CacheClient.get(client, "cache", "non-existent-key")
:miss
@spec list_caches(client :: t()) :: Momento.Responses.ListCaches.t()
List all caches.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.
returns
Returns
{:ok, %Momento.Responses.ListCaches.Ok{caches: caches}}
on a successful listing. It contains:caches: [%Momento.Responses.CacheInfo{}]
{:error, error}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.list_caches(client)
{:ok,
%Momento.Responses.ListCaches.Ok{
caches: [
%Momento.Responses.CacheInfo{
name: "cache"
}
]
}}
@spec set( client :: t(), cache_name :: String.t(), key :: binary(), value :: binary(), opts :: [ttl_seconds :: number()] ) :: Momento.Responses.Set.t()
Set a value in a cache. Replaces the existing value if one is present.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache to store the value in. Must be a string.key
: The key to store the value under. Must be a binary.value
: The value to be stored. Must be a binary.
options
Options
ttl_seconds
: The time-to-live of the cache entry in seconds. Must be positive. Defaults to the client TTL.
returns
Returns
{:ok, %Momento.Responses.Set.Ok{}}
on a successful set.{:error, error}
tuple if an error occurs.
examples
Examples
iex> Momento.CacheClient.set(client, "cache", "key", "value")
{:ok, %Momento.Responses.Set.Ok{}}
iex> Momento.CacheClient.set(client, "cache", "key", "value", ttl_seconds: 600.0)
{:ok, %Momento.Responses.Set.Ok{}}
sorted_set_fetch_by_rank(client, cache_name, sorted_set_name, opts \\ [])
View Source@spec sorted_set_fetch_by_rank( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), opts :: [start_rank: integer(), end_rank: integer(), sort_order: :asc | :desc] ) :: Momento.Responses.SortedSet.Fetch.t()
Fetch the values and scores from a sorted set by rank. The returned values are ordered by their scores.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to fetch the values from. Must be a string.
options
Options
start_rank
: The inclusive 0-indexed rank of the first value. If not provided, the fetch starts from the beginning of the set. Must be an integer.end_rank
: The exclusive 0-indexed rank of the last value. If not provided, the fetch goes to the end of the set. Must be an integer.sort_order
: The order to sort the set before trimming by rank and fetching. Defaults to ascending. Must be :asc or :desc.
returns
Returns
{:ok, %Momento.Responses.SortedSet.Fetch.Hit{}}
if the sorted set exists. It contains:value: [{binary(), float()}]
:miss
if the sorted set does not exist.{:error, %Momento.Error{}}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_put_elements(client, "cache", "sorted-set",
...> [{"val1", 1.0}, {"val2", 2.0}, {"val3", 3.0}])
{:ok, %Momento.Responses.SortedSet.PutElements.Ok{}}
iex> Momento.CacheClient.sorted_set_fetch_by_rank(client, "cache", "sorted-set")
{:ok,
%Momento.Responses.SortedSet.Fetch.Hit{
value: [{"val1", 1.0}, {"val2", 2.0}, {"val3", 3.0}]
}}
iex> Momento.CacheClient.sorted_set_fetch_by_rank(client, "cache", "sorted-set", sort_order: :desc)
{:ok,
%Momento.Responses.SortedSet.Fetch.Hit{
value: [{"val3", 3.0}, {"val2", 2.0}, {"val1", 1.0}]
}}
iex> Momento.CacheClient.sorted_set_fetch_by_rank(client, "cache", "sorted-set", start_rank: 1, end_rank: 2)
{:ok, %Momento.Responses.SortedSet.Fetch.Hit{value: [{"val2", 2.0}]}}
iex> Momento.CacheClient.sorted_set_fetch_by_rank(client, "cache", "sorted-set", start_rank: 5, end_rank: 10)
{:ok, %Momento.Responses.SortedSet.Fetch.Hit{value: []}}
iex> Momento.CacheClient.sorted_set_fetch_by_rank(client, "cache", "empty-sorted-set")
:miss
sorted_set_fetch_by_score(client, cache_name, sorted_set_name, opts \\ [])
View Source@spec sorted_set_fetch_by_score( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), opts :: [ min_score: number(), max_score: number(), offset: integer(), count: integer(), sort_order: :asc | :desc ] ) :: Momento.Responses.SortedSet.Fetch.t()
Fetch the values and scores from a sorted set by score. The returned values are ordered by their scores.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to fetch the values from. Must be a string.
options
Options
min_score
: The inclusive minimum score for a fetched value. If not provided, the fetch starts from the beginning of the set. Must be a number.end_rank
: The inclusive maximum score for a fetched value. If not provided, the fetch goes to the end of the set. Must be a number.offset
: The number of elements to skip before returning the first element. Must be an integer. Defaults to 0.count
: The maximum number of elements to return. Must be an integer. Defaults to all elements.sort_order
: The order to sort the set before trimming by rank and fetching. Defaults to ascending. Must be :asc or :desc.
returns
Returns
{:ok, %Momento.Responses.SortedSet.Fetch.Hit{}}
if the sorted set exists. It contains:value: [{binary(), float()}]
:miss
if the sorted set does not exist.{:error, %Momento.Error{}}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_put_elements(client, "cache", "sorted-set",
...> [{"val1", 1.0}, {"val2", 2.0}, {"val3", 3.0}])
{:ok, %Momento.Responses.SortedSet.PutElements.Ok{}}
iex> Momento.CacheClient.sorted_set_fetch_by_score(client, "cache", "sorted-set")
{:ok,
%Momento.Responses.SortedSet.Fetch.Hit{
value: [{"val1", 1.0}, {"val2", 2.0}, {"val3", 3.0}]
}}
iex> Momento.CacheClient.sorted_set_fetch_by_score(client, "cache", "sorted-set", sort_order: :desc)
{:ok,
%Momento.Responses.SortedSet.Fetch.Hit{
value: [{"val3", 3.0}, {"val2", 2.0}, {"val1", 1.0}]
}}
iex> Momento.CacheClient.sorted_set_fetch_by_score(client, "cache", "sorted-set", min_score: 1.1, max_score: 3.0)
{:ok,
%Momento.Responses.SortedSet.Fetch.Hit{value: [{"val2", 2.0}, {"val3", 3.0}]}}
iex> Momento.CacheClient.sorted_set_fetch_by_score(client, "cache", "sorted-set", offset: 1, count: 1)
{:ok, %Momento.Responses.SortedSet.Fetch.Hit{value: [{"val2", 2.0}]}}
iex> Momento.CacheClient.sorted_set_fetch_by_score(client, "cache", "sorted-set", min_score: 99.9)
{:ok, %Momento.Responses.SortedSet.Fetch.Hit{value: []}}
iex> Momento.CacheClient.sorted_set_fetch_by_score(client, "cache", "empty-sorted-set")
:miss
sorted_set_get_rank(client, cache_name, sorted_set_name, value, opts \\ [])
View Source@spec sorted_set_get_rank( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), value :: binary(), opts :: [{:sort_order, :asc | :desc}] ) :: Momento.Responses.SortedSet.GetRank.t()
Get the rank of a value in a sorted set.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to get the rank from. Must be a string.value
: The value to check the rank of. Must be a binary.
options
Options
sort_order
: The order to sort the set before finding the rank of the value. Defaults to ascending. Must be :asc or :desc.
returns
Returns
{:ok, %Momento.Responses.SortedSet.GetRank.Hit{}}
if the value exists. It contains:rank: integer()
:miss
if the value does not exist.{:error, error}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_put_elements(client, "cache", "sorted-set",
...> [{"val1", 1.0}, {"val2", 2.0}, {"val3", 3.0}])
{:ok, %Momento.Responses.SortedSet.PutElements.Ok{}}
iex> Momento.CacheClient.sorted_set_get_rank(client, "cache", "sorted-set", "val1")
{:ok, %Momento.Responses.SortedSet.GetRank.Hit{rank: 0}}
iex> Momento.CacheClient.sorted_set_get_rank(client, "cache", "sorted-set", "val1", sort_order: :desc)
{:ok, %Momento.Responses.SortedSet.GetRank.Hit{rank: 2}}
iex> Momento.CacheClient.sorted_set_get_rank(client, "cache", "sorted-set", "non-existent-value")
:miss
@spec sorted_set_get_score( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), value :: binary() ) :: Momento.Responses.SortedSet.GetScore.t()
Get the score of a value in a sorted set.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to get the score from. Must be a string.value
: The value to check the score of. Must be a binary.
returns
Returns
{:ok, %Momento.Responses.SortedSet.GetScore.Hit{}}
if the value exists. It contains:score: float()
:miss
if the value does not exist.{:error, error}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_put_elements(client, "cache", "sorted-set",
...> [{"val1", 1.0}, {"val2", 2.0}, {"val3", 3.0}])
{:ok, %Momento.Responses.SortedSet.PutElements.Ok{}}
iex> Momento.CacheClient.sorted_set_get_score(client, "cache", "sorted-set", "val1")
{:ok, %Momento.Responses.SortedSet.GetScore.Hit{score: 1.0}}
iex> Momento.CacheClient.sorted_set_get_score(client, "cache", "sorted-set", "non-existent-value")
:miss
sorted_set_get_scores(client, cache_name, sorted_set_name, values)
View Source@spec sorted_set_get_scores( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), values :: [binary()] ) :: Momento.Responses.SortedSet.GetScores.t()
Get the scores of the given values in a sorted set.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to get the score from. Must be a string.values
: The value to check the score of. Must be a list of binaries.
returns
Returns
{:ok, %Momento.Responses.SortedSet.GetScores.Hit{}}
if the value exists. It contains:value: [{binary(), float() | nil}]
:miss
if the sorted set does not exist.{:error, error}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_put_elements(client, "cache", "sorted-set",
...> [{"val1", 1.0}, {"val2", 2.0}, {"val3", 3.0}])
{:ok, %Momento.Responses.SortedSet.PutElements.Ok{}}
iex> Momento.CacheClient.sorted_set_get_scores(client, "cache", "sorted-set", ["val1", "val2"])
{:ok,
%Momento.Responses.SortedSet.GetScores.Hit{
value: [{"val1", 1.0}, {"val2", 2.0}]
}}
iex> Momento.CacheClient.sorted_set_get_scores(client, "cache", "sorted-set", ["non-existent-value"])
{:ok,
%Momento.Responses.SortedSet.GetScores.Hit{
value: [{"non-existent-value", nil}]
}}
iex> Momento.CacheClient.sorted_set_get_scores(client, "cache", "non-existent-set", ["val1"])
:miss
sorted_set_increment_score(client, cache_name, sorted_set_name, value, amount, opts \\ [])
View Source@spec sorted_set_increment_score( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), value :: binary(), amount :: number(), opts :: [collection_ttl :: Momento.Requests.CollectionTtl.t()] ) :: Momento.Responses.SortedSet.IncrementScore.t()
Increments the score of a value in a sorted set. Adds the value if it is not present.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to increment the value in. Must be a string.value
: The value to be incremented. Must be a binary.amount
: The amount to increment the value's score Must be a number.
options
Options
collection_ttl
: The TTL for the sorted set in the cache. Defaults to the client TTL.
returns
Returns
{:ok, %Momento.Responses.SortedSet.IncrementScore.Ok{}}
on a successful increment.{:error, %Momento.Error{}}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_get_score(client, "cache", "sorted-set", "value")
:miss
iex> Momento.CacheClient.sorted_set_increment_score(client, "cache", "sorted-set", "value", 1.0)
{:ok, %Momento.Responses.SortedSet.IncrementScore.Ok{score: 1.0}}
iex> Momento.CacheClient.sorted_set_get_score(client, "cache", "sorted-set", "value")
{:ok, %Momento.Responses.SortedSet.GetScore.Hit{score: 1.0}}
sorted_set_put_element(client, cache_name, sorted_set_name, value, score, opts \\ [])
View Source@spec sorted_set_put_element( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), value :: binary(), score :: number(), opts :: [collection_ttl :: Momento.Requests.CollectionTtl.t()] ) :: Momento.Responses.SortedSet.PutElement.t()
Add a value and score to a sorted set. Replaces the existing score if the value is already present.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to store the value in. Must be a string.value
: The value to be stored. Must be a binary.score
: The score of the value. Determines the value's position in the sorted set. Must be a number.
options
Options
collection_ttl
: The TTL for the sorted set in the cache. Defaults to the client TTL.
returns
Returns
{:ok, %Momento.Responses.SortedSet.PutElement.Ok{}}
on a successful put.{:error, %Momento.Error{}}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_put_element(client, "cache", "sorted-set", "value", 1.0)
{:ok, %Momento.Responses.SortedSet.PutElement.Ok{}}
iex> ttl = Momento.Requests.CollectionTtl.of(60.0)
%Momento.Requests.CollectionTtl{ttl_seconds: 60.0, refresh_ttl: true}
iex> Momento.CacheClient.sorted_set_put_element(client, "cache", "sorted-set", "value", 1.0, collection_ttl: ttl)
{:ok, %Momento.Responses.SortedSet.PutElement.Ok{}}
iex> ttl = Momento.Requests.CollectionTtl.refresh_ttl_if_provided(nil)
%Momento.Requests.CollectionTtl{ttl_seconds: nil, refresh_ttl: false}
iex> Momento.CacheClient.sorted_set_put_element(client, "cache", "sorted-set", "value", 1.0, collection_ttl: ttl)
{:ok, %Momento.Responses.SortedSet.PutElement.Ok{}}
sorted_set_put_elements(client, cache_name, sorted_set_name, elements, opts \\ [])
View Source@spec sorted_set_put_elements( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), elements :: %{required(binary()) => number()} | [{binary(), number()}], opts :: [collection_ttl :: Momento.Requests.CollectionTtl.t()] ) :: Momento.Responses.SortedSet.PutElements.t()
Add the given values and scores to a sorted set. Replaces the existing score for any value already present.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to store the value in. Must be a string.elements
: The values and scores to be stored. Must be an enum of binary to number.
options
Options
collection_ttl
: The TTL for the sorted set in the cache. Defaults to the client TTL.
returns
Returns
{:ok, %Momento.Responses.SortedSet.PutElements.Ok{}}
on a successful put.{:error, %Momento.Error{}}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_put_elements(client, "cache", "sorted-set", [{"val1", 1.0}, {"val2", 2.0}])
{:ok, %Momento.Responses.SortedSet.PutElements.Ok{}}
iex> Momento.CacheClient.sorted_set_put_elements(client, "cache", "sorted-set", %{"val1" => 1.0, "val2" => 2.0})
{:ok, %Momento.Responses.SortedSet.PutElements.Ok{}}
iex> ttl = Momento.Requests.CollectionTtl.of(60.0)
%Momento.Requests.CollectionTtl{ttl_seconds: 60.0, refresh_ttl: true}
iex> Momento.CacheClient.sorted_set_put_elements(client, "cache", "sorted-set", [{"val1", 1.0}], collection_ttl: ttl)
{:ok, %Momento.Responses.SortedSet.PutElements.Ok{}}
sorted_set_remove_element(client, cache_name, sorted_set_name, value)
View Source@spec sorted_set_remove_element( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), value :: binary() ) :: Momento.Responses.SortedSet.RemoveElement.t()
Remove an element from a sorted set.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to remove the value from. Must be a string.value
: The value to be removed. Must be a binary.
returns
Returns
{:ok, %Momento.Responses.SortedSet.RemoveElement.Ok{}}
on a successful put.{:error, %Momento.Error{}}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_remove_element(client, "cache", "sorted-set", "value")
{:ok, %Momento.Responses.SortedSet.RemoveElement.Ok{}}
sorted_set_remove_elements(client, cache_name, sorted_set_name, values)
View Source@spec sorted_set_remove_elements( client :: t(), cache_name :: String.t(), sorted_set_name :: String.t(), values :: [binary()] ) :: Momento.Responses.SortedSet.RemoveElements.t()
Remove multiple elements from a sorted set.
parameters
Parameters
client
: A%Momento.CacheClient{}
representing the connected client.cache_name
: The name of the cache containing the sorted set. Must be a string.sorted_set_name
: The name of the sorted set to remove the values from. Must be a string.values
: The value to be removed. Must be a list of binaries.
returns
Returns
{:ok, %Momento.Responses.SortedSet.RemoveElements.Ok{}}
on a successful put.{:error, %Momento.Error{}}
if an error occurs.
examples
Examples
iex> Momento.CacheClient.sorted_set_remove_elements(client, "cache", "sorted-set", ["value1", "value2"])
{:ok, %Momento.Responses.SortedSet.RemoveElements.Ok{}}