https://github.com/gialib/memcache_elixir
Elixir Memcache Cache Client
https://github.com/gialib/memcache_elixir
elixir memcache
Last synced: 7 months ago
JSON representation
Elixir Memcache Cache Client
- Host: GitHub
- URL: https://github.com/gialib/memcache_elixir
- Owner: gialib
- Created: 2018-05-30T15:02:01.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-23T04:24:25.000Z (over 7 years ago)
- Last Synced: 2025-07-28T02:18:45.358Z (7 months ago)
- Topics: elixir, memcache
- Language: Elixir
- Homepage: https://hexdocs.pm/memcache
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Installing
You can install `Memcache` by adding it as a dependecy to your
project's `mix.exs` file:
```elixir
defp deps do
[
{:memcache, "~> 0.1.2"}
]
end
```
## Examples
### Get value for a key:
```elixir
response = Memcache.get("key")
case response.status do
:ok ->
{:ok, response.value}
status ->
{:error, status}
end
```
### Fetch
```elixir
value = Memcache.fetch!("hello", fn ->
"world"
end)
# value == "world"
value = Memcache.fetch!("hello", fn ->
"world2"
end)
# value == "world"
```
### Config like this
```elixir
config :memcache,
host: "127.0.0.1",
port: 11211,
auth_method: :none,
username: "",
password: "",
pool_size: 10,
pool_max_overflow: 20,
namespace: "default"
```