Skip to content

arnu515/glemcached

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Package Version Hex Docs

glemcached

Memcached client in pure gleam! (except the TCP client, of course! That's mug).

Made with the goal of fully supporting the Memcached protocol!

Features

(help wanted!)

  • Authentication
  • Text Commands
  • SSL
  • Meta Commands
  • Connection pooling
  • Cluster support
  • First class actor support
  • JavaScript (!Browser) support with promises

Binary commands are deprecated and hence will not be implemented.

Install

gleam add glemcached

Example with text commands

import gleam/bit_array
import gleam/io
import glemcached.{connect, with_authentication, with_timeout}
import glemcached/text

pub fn main() {
  let assert Ok(mem) =
    glemcached.new("localhost", 11_211)
    |> with_timeout(500)
    |> with_authentication("user", "pass")
    |> connect()

  let assert Ok(Nil) = text.set(mem, "foo", 123, 0, <<"Hello">>)
  let assert Ok(True) = text.append(mem, "foo", 123, 0, <<", world!">>)
  let assert Ok([value]) = text.get(mem, ["foo"])
  let assert Ok(value) = bit_array.to_string(value.data)

  // clean up!
  let assert Ok(True) = text.delete(mem, "foo")

  io.println(value)
}

Further documentation can be found at https://hexdocs.pm/glemcached.

Development

gleam run -m glemcached/examples/text # Run the example
gleam test  # Run the tests

About

A memcached client for gleam

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages