Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Crux.Cache

Library providing Discord API struct caches for crux.

Useful links

Installation

The library can be installed by adding crux_cache to your list of dependencies in mix.exs:

def deps do
  [
    {:crux_cache, "~> 0.2.0"}
  ]
end

Usage

Small example:

# Should be part of supervision tree
iex> {:ok, pid} = Crux.Cache.Default.start_link()
{:ok, #PID<0.178.0>}

iex(2)> Crux.Cache.User.insert(%{
...(2)>     "avatar" => "646a356e237350bf8b8dfde15667dfc4",
...(2)>     "discriminator" => "0001",
...(2)>     "id" => "218348062828003328",
...(2)>     "username" => "space"
...(2)>   }
...(2)> )
%{
  avatar: "646a356e237350bf8b8dfde15667dfc4",
  discriminator: "0001",
  id: 218348062828003328,
  username: "space"
}

iex(3)> Crux.Cache.User.fetch!(218348062828003328)
%Crux.Structs.User{
  avatar: "646a356e237350bf8b8dfde15667dfc4",
  bot: false,
  discriminator: "0001",
  id: 218348062828003328,
  username: "space"
}

About

A library providing a cache for Discord API structures

Topics

Resources

License

Packages

No packages published